I'm trying to set the appropriate STATIC_URL and STATIC_ROOT values for a new Django project, and I am having trouble using the absolute URL for STATIC_URL.
My project is structured as:
<project root> static media src <apps> static js css custom.css i settings.py
In my settings.py I have
STATIC_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../static/'))
If I set STATIC_URL = '/static/' , then I can access http://localhost:8000/static/css/custom.css perfectly.
However, if I use an absolute URL, for example STATIC_URL = 'http://localhost:8000/static/' , as if I used the CDN, then http://localhost:8000/static/css/custom.css returns a 404 error .
Shouldn't these settings be virtually the same? The state of docs STATIC_URL may be absolute. Why doesn’t the static media load in later settings?
Cerin source share