Reputation: 4557
On my development env, I get this error when trying to access static css file:
Page not found (404)
Request Method: GET Request URL:
Some lines from the settings.py
:
DEBUG = True
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
STATIC_URL = '/static/'
Path to my styles.css
file (where eshop
is a root folder of my project):
/eshop/static/styles.css
Relevant lines from my html file:
{% load staticfiles %}
<head>
<link rel="stylesheet" type="text/css" href="{% static 'styles.css' %}" />
...
Could you please advice on what i'm doing wrong?
Upvotes: 2
Views: 980
Reputation: 10971
Add the following to your settings.py
file:
# define global static
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
Or just put the static files inside each app:
app_folder/static/app_name
Upvotes: 2