0
votes

In my Django project I have a static folder in the root of the project (near manage.py), so in settings.py, in order to find this static files I have:

STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),]

How do I have to configure STATIC_ROOT? Now I think about:

STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

But when I run collectstatic it fails, static files are loaded but not in the admin site.

How can I solve this issue?

1
You want your static files in the admin app? - schrodigerscatcuriosity

1 Answers

3
votes

STATIC_ROOT (doc) is the folder where every static files will be stored after a manage.py collectstatic

STATICFILES_DIRS (doc) is the list of folder where Django will search for additional static files, in addition to each static folder of each app installed.

So, if you use [project_root]/static directory as an additional folder you have to add it to STATICFILES_DIRS and use any other name for STATIC_ROOT

STATIC_ROOT = os.path.join(BASE_DIR, 'collected_static/')