1👍
If you are using nginx, you would add the following location to your server block
location /static/ {
root /home/huhu/webapps/eng30_static_media;
}
Because you have DEBUG
set to False
, django will not serve the staticfiles for you in production like it does on your dev server. This is by design because, as the documentation notes, the staticfiles application is grossly inefficient and may be insecure: https://docs.djangoproject.com/en/1.10/howto/static-files/
1👍
Open your browser console and see the response that is returned when fetching static files.
You have to let your web server serve files. Make sure that your web server (apache/nginx) have proper permissions to access the static directory
, which in your case ‘/home/huhu/webapps/eng30_static_media/static’.
If you will still be facing issues, then move static files to /var/www/static directory if you are using apache
and change your static root to
STATIC_ROOT = '/var/www/static'
Check permissions/ownership on files using ls -l
ls -l
-rw-r--r-- 1 www-data www-data 11321 Jul 28 17:08 index.html
for apache user/group www-data/www-data
must have access on files that needs to be served through server. If files are owned by others, try a chown
on the files/directories to change ownership.
chown -R chown -R username:group directory
If you are using nginx, then define your static files directory in nginx conf
and try reloading the page.
- [Answered ]-Where is the django CMS history tab?
- [Answered ]-I am attempting to add two models from separate local apps into one template
- [Answered ]-Django JWT asking for username/password
- [Answered ]-Custom view does not show results in Django Haystack with Elastic Search