By kkteja
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!
When you set Debug=False you need to make sure that you’ve also set your domain and/or external IP address in ALLOWED_HOSTS. See the Django documentation:
When DEBUG is True or when running tests, host validation is disabled; any host will be accepted. Thus it’s usually only necessary to set it in production.
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?
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; }
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.