1

I am writing a app using AJAX deployed by gunicorn and nginx on AWS. It works very well when I am using python3 manage.py runserver. But after I used gunicorn, the AJAX post doesn't work. I get a Failed to load resource: the server responded with a status of 404 (Not Found).

What I did is a very simple AJAX post

$.ajax({
                type: 'POST',
                url: '/analytical-tools/getData/',
                data: {
                  'somedata':somedata
                  csrfmiddlewaretoken: '{{ csrf_token }}'
                },
                dataType: 'json',
                success: function (data) {
                   /*do something*/
                }
});

First I want to ask is is there any difference on AJAX when deployed on Gunicorn? And I want to ask how to debug on gunicorn. The gunicorn runs in the background and I can't see any debug information or print something when it is running.

fourth
  • 599
  • 2
  • 5
  • 20

1 Answers1

0

404 stand for not found... and here is the question is the django endpoint available at all or not available for certain data?

1) if at all mayby the config nginx/gunicorn is problematic

2) if for certain data make sure this data are really there

3) idea make sure there is no crap in JS, e.g have a look into XHR section and copy the request load, and cross validate it in Postman

Regarding debuging, there should be files in logs with each request etc.

where uwsgi? https://www.digitalocean.com/community/questions/where-s-my-django-application-log-file

where nginx? Where can I find the error logs of nginx, using fastcgi and django

andilabs
  • 22,159
  • 14
  • 114
  • 151