I’ve wasted 2 entire days without any help on this issue. I followed this guide and have started my application on Digital Ocean. It’s a djago app. The issue is, it is not loading any static file! My nano /etc/nginx/sites-available/webapp_name file looks like this:
server {
server_name domainname.com;
access_log off;
location /static/ {
root /opt/bizkeeda;
}
My static files are in folder: /opt/appname/static/
My settings.py file looks like this:
STATIC_URL = '/static/'
STATICFILES_DIR = '/opt/appname/static/'
STATIC_ROOT = '/opt/appname/static/'
I also tried changing STATIC_ROOT to /opt/appname
On checking url of static files on website, it is: www.domain.com:8001/static/js/abc.js
All 404 errors! What should I do?
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!
Have you run python manage.py collectstatic after uploading the app? Can you check if there are any errors in nginx’s error log?
sudo tail -30 /var/log/nginx/error.log
The solution is to either:
or
Hey Shekhar,
Did you find the solution to this, I am also facing the similar issue for my python flask application. It would be very helpful if you could share the solution that worked for you.
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.