Closed mmichealjroberts closed 5 years ago
I have done the usual python manage.py collectstatic --no-input
command on run.
Tried:
$ docker-compose -f production.yml run nginx ls /usr/src/app/static
Output:
$ ls: cannot access /usr/src/app/static: No such file or directory
$ docker-compose -f production.yml run nginx ls /www/static
Returns:
$ admin
The fix was to change the location alias to point to the same as in the production.yml file, i.e., /www/static.
Change sites-enabled/django-project to:
server {
listen 80;
server_name example.org;
charset utf-8;
location /static {
alias /www/static;
}
location / {
proxy_pass http://web:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
The serving of static assets in the production deployment is not working.
The call to anything in /static/ returns a 404 Nginx Error.