1👍
So I’m not sure but maybe instead of alias you could use root and rewrite the request on NGINX. It can be like:
location /static{
rewrite /static/(.*) /static/$1 break;
root /path/to/project;
}
First try without the rewrite, just setting the root for the static files, if it doesn’t work try to set the root to the path of the project and rewrite to static.
0👍
I found the solution,
By including proxy headers in nginx conf file, requests were handled correctly.
upstream django_server {
server django:8000;
}
server {
listen 80;
location /static/ {
alias /app/static/;
}
location /media/ {
alias /app/media/;
}
location / {
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-Proto $scheme;
proxy_pass http://django_server;
}
}
- [Answered ]-Django: raw SQL queries with a dynamic number of variables
- [Answered ]-Django Tastypie – Filtering ToManyField resource with URL parameter
- [Answered ]-Django model manager didn't work with related object when I do aggregated query
- [Answered ]-Notify user about bounced confirmation emails
Source:stackexchange.com