I am using ubuntu os and when I deployed my Django/Python app, it works only when I mention Debug=True. Apart from that when I start the server and navigate to browser I see that its not loading the static folder -any ideas?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
fixed it, this is because of the conflict between STATIC_ROOT = /static/ in settings.py and configuration in /etc/nginx/sites-enabled/django file, remove this part and do not forget to restart the service with service nginx restart location /media { alias /home/django/supchang/media; } location /static { alias /home/django/ssupchang/static; }
Hi,
You need to post more info: did you run ./manage.py collectstatic? What is in your settings.py, especially the STATIC_FILES setting? How are u using the image reference in your template? Are you using {% load staticfiles %} and then use {% static ‘myimgpath’ %}? Are your static files supposed to be hosted on the same instance your app is running?
When you set
Debug=False
you need to make sure that you’ve also set your domain and/or external IP address inALLOWED_HOSTS
. See the Django documentation: