In settings.py, if I specify STATIC_URL = 'http://68.164.125.221/', then clients can visit my web page. However, no CSS and other static files load.
On the other hand, if I specify STATIC_URL = '/', then visiting the home page of my application produces this error.
Page not found (404)
Request Method: GET
Request URL: http://68.164.125.221/
Directory indexes are not allowed here.
You're seeing this error because you have DEBUG = True in your Django settings file.
Interestingly, my static files now load (http://68.164.125.221/main.css loads for instance) despite the home page of my app displaying this error.
Why does changing my “STATIC_URL” setting toggle whether my home page loads or my static files load? I am using the staticfiles app.
You probably want
STATIC_URL = '/static/'[1]; when you set it to/Django is trying to serve up/blah/as a static file rather than pushing it through to your Django app.The actual error you’re getting,
Directory indexes are not allowed here., refers to the fact that the static file folders aren’t listed out – you must access a specific file for it to be served up.[1] Or /media/, or /files/, or whatever… just not ‘/’.