Django Static files serving
See original GitHub issueHello am new to nginx proxy manger and soo far i have understood the workflow however in the location section am having a bit of trouble… am running a django app with gunicorn which only handles python code hence my static files(javaScript & CSS) are not being served… i want to include them in the location area but every time I do it the host goes offline… if I used an nginx config file traditionally this is what it would look like
server {
listen 80;
server_name YOUR_IP_ADDRESS;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/djangoadmin/pyapps/btre_project;
}
location /media/ {
root /home/djangoadmin/pyapps/btre_project;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
I want the proxy params , media and static to be included in location but I can’t find a way… kindly assist
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
How to manage static files (e.g. images, JavaScript, CSS)
Websites generally need to serve additional files such as images, JavaScript, or CSS. In Django, we refer to these files as “static files”....
Read more >How do you serve static files when using the django runserver ...
Create a folder called media inside static and keep all your media files inside that. Run python manage.py collectstatic to collect all your...
Read more >Serving Static Files - Matt Layman
An alternative approach to using Django to serve static files is to use another program as a reverse proxy. This setup is more...
Read more >Working with Static and Media Files in Django | TestDriven.io
STATICFILES_DIRS: By default, static files are stored at the app-level at <APP_NAME>/static/ . The collectstatic command will look for static ...
Read more >Serving static files with Django - API Bakery
If you're using cloud storage such as Amazon S3, you probably use the excellent django-storages. It makes serving static files directly from the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
you welcome… Glad i could help 🔥
It can cause problems when adding an advanced configuration and enable “cache assets”. I got a 404 trying to load asset files (Django static and media). It works after disabling “cache assets”.