We have our Django 1.9.6 application running in a Docker container. The docker container has nginx configured to serve the static files.
We link to /admin and it will take us to the /admin pages but when we click a link it takes us to /usr/src/app/admin/api/module/
I can tell you Django is running from the directory /usr/src/app.
We tried adding FORCE_SCRIPT_NAME=''
to the settings and this has not helped.
The Django app is running via Daphne (as we are using Channels)
Here is our nginx config:
server {
listen 80 default_server;
charset utf-8;
# max upload size
client_max_body_size 4G;
# Django media
location /media {
alias /usr/src/app/media;
}
location /static {
alias /usr/src/app/static-collect; - amend as required
}
location / {
proxy_pass http://0.0.0.0:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}`