Reputation: 10554
I have a project with this structure
myproject
├── myproject
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── settings.py
│ ├── settings.pyc
│ ├── urls.py
│ ├── urls.pyc
│ ├── wsgi.py
│ └── wsgi.pyc
├── manage.py
├── showcase
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── admin.py
│ ├── migrations
│ │ └── __init__.py
│ ├── models.py
│ ├── tests.py
│ ├── urls.py
│ ├── urls.pyc
│ ├── views.py
│ └── views.pyc
├── static
│ └── images
│ ├── pics01.jpg
│ └── pics11.jpg
└── templates
└── showcase
└── base.html
In settings.py
I've declared:
STATIC_URL = '/static/'
and by connecting to 127.0.0.1/static/images/pics01.jpg
I get a 404 error
'images/pics01.jpg' could not be found
Why is this?
urlpatterns += staticfiles_urlpatterns()
is already in the project urls.py
as I followed this question.
Upvotes: 0
Views: 71
Reputation: 45585
You should set the STATICFILES_DIRS
setting:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
Upvotes: 2