This is my settings.py
STATIC_URL = '/static/'
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
My structure is:
manage.py
myproject
-- __init__.py
-- settings.py
-- urls.py
-- wsgi.py
-- static
----- css
----- img
-------- logo.png
----- scripts
I use the static tag in my html file like this: <img src="{{ STATIC_URL }}img/logo.png">
But, it is:
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (logo.png, line 0)
I really can't understand this issue on Django 1.6.2 version.
Could someone help me to solve this issue?
Thanks in advance!
You need to make sure that the
django.contrib.staticfiles
app is listed inINSTALLED_APPS
:Lastly, you need to make sure that
DEBUG
is set toTrue
insettings.py
.EDIT:
Try removing
'django.contrib.staticfiles.finders.DefaultStorageFinder'
fromSTATICFILES_FINDERS
. Then run$ python manage.py findstatic img/logo.png