Forums

Receiving .json not found error in web2py application "NetworkError: 404 NOT FOUND ...Ajax.json"

I m sending data to server using ajax call. Application is working fine on local machine but throws /sample/default/simpleAjax.json file not found error on console when host on pythonanywhere.com

Can you please help in resolving this issue ?

When I try to get that URL from your webapp, I get an "Invalid request" error. That suggests that there's some sort of config difference between your PythonAnywhere installation and your local machine. Perhaps you haven't installed the "sample" app?

I thought there might be version issue since my local machine is running web2py version 2.10.4 whereas its 2.9 on pythonanywhere. So I uploaded 2.10.4 version on pythonanywhere. Sample app is also installed (https://neerdshukla.pythonanywhere.com/sample/default/index/login). But issue still persists. It should redirect to login page after clicking on place order button. It works fine on my local machine but on its showing "NetworkError: 404 NOT FOUND ...Ajax.json" error on pythonanywhere.

Issue is solved. Actually /functions.ajax is disabled by default for host other than localhost. Modified code line response.generic_patterns = [''] if request.is_local else [] in db.py to response.generic_patterns = [''] And ajax call is working now.

Thanks for help.