Sergey
Sergey

Reputation: 21261

Django admin, static files use wrong directory

I am using django 1.4, and when I have this in settings:

STATIC_URL = '/_s/'
STATICFILES_DIRS = (
    ('admin', '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin'),
)

And then access /_s/admin/css/base.css Django tries to load it from a different path and writes:

"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/css/base.css" does not exist

Why does this happens?

UPD
I use ./manage.py runcserver 0.0.0.0:8001

Upvotes: 1

Views: 1377

Answers (2)

Sergey
Sergey

Reputation: 21261

The problem was in

./manage.py runcserver 0.0.0.0:8001

I used concurrent server, not default django debug server (I thought they both work in the same way (except threads))

But it is not true =(

UPD
From 1.4 you can use django debug server, it is multithreaded by default.

Upvotes: 1

rockingskier
rockingskier

Reputation: 9346

The STATICFILES_DIRS is used for collecting static files, ./manage.py collectstatic. It tell Django which folders to look in in order to pull all static files together in to one place.

When serving up static files Django will only look in STATIC_ROOT.

Official docs

Upvotes: 2

Related Questions