Amin Oruji
Amin Oruji

Reputation: 74

Django nginx uwsgi ending slash

I used nginx and uwsgi for djangobook.ir and I have this problem. any request to djangobook.ir/toc (without ending slash) redirects to djangobook.irdjangobook_ir.wsgi! but I don't have a problem with djangobook.ir/toc/ (with ending slash).

server {
    listen 80;
    server_name djangobook.ir;
        charset utf-8;

        access_log /var/log/nginx/app_access.log;
        error_log /var/log/nginx/app_error.log;
        root /home/aminpy/djangobook_ir/;

        location /static/ {
                alias /home/aminpy/djangobook_ir/static/;
        }

        location /statics/ {
                alias /home/aminpy/djangobook_ir/statics/;
        }

        location / {
                uwsgi_pass 127.0.0.1:5000;
                include uwsgi_params;
                root /home/aminpy/djangobook_ir/;
                uwsgi_param UWSGI_SCRIPT djangobook_ir.wsgi;
                uwsgi_param SCRIPT_NAME djangobook_ir.wsgi;
                uwsgi_param UWSGI_CHDIR $document_root;
        }
}

you can test it online! how can I fix this problem?

Upvotes: 0

Views: 305

Answers (1)

roberto
roberto

Reputation: 12953

remove SCRIPT_NAME it is the WSGI standard way to prefix/mountpoint applications.

What you are experiencing is what it is expected :)

Upvotes: 2

Related Questions