I\'m having issues serving up static files - i.e. style sheets and images required from my html pages. I cannot seem to fathom why these static images are not being found. H
Hey I just had the same problem and I found a way to make it work.
Just go to your settings.py and make some changes
replace
DJ_PROJECT_DIR = os.path.dirname(__file__)
BASE_DIR = os.path.dirname(DJ_PROJECT_DIR)
WITH
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
down at the end of settings.py file add this
STATIC_URL = '/static/'
TEMPLATE_DIRS = [
os.path.join(BASE_DIR, 'templates'),
]
STATIC_ROOT = os.path.join(BASE_DIR, '../static')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static', 'dirs'),
)
and in your html file just don't forget to load staticfiles like that
{% load staticfiles %}
It works!
now your directories should look like that
--wsgi
--myproject
--templates
-- drop html files here ...
--static
--dirs
--img
-- drop images here ..
--js
-- drop js here ..
--css
-- drop css files here ..