[Fixed]-Correct static files setting

1👍

The python manage.py collectstatic command looks for all your static directories and combines those file in the directory defined by the STATIC_ROOT setting.

In your case, STATIC_ROOT is set to os.path.join(os.path.dirname(BASE_DIR), "static", "static"), i.e.

your_project/static/static

So this is where the static files are being collected to. If you want them in the outer static directory, you can change STATIC_ROOT to os.path.join(os.path.dirname(BASE_DIR), "static").

There is a good discussion of this in the excellent Django docs here.

There is quite a lot to take in in these settings, so here is a quick summary of each static setting as an example:

# this is the URL that django will look for static resources at
# - i.e. http://your_domain/static
# so this one is a URL used when by your web server and in template
# shortcuts.
STATIC_URL = '/static/' 

# this is where Django will look for static files to collect. 
# I.e. the search locations that collectstatic uses.  
# 'my_project/static' in this instance. You need to add the places
# you write your static files to this directory. For example, if you
# have several places where you are writing css files, add their
# container directories to this setting.
# it is a list of places to look for static files.
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),) 

# this is where collectstatic will collect the static files to. 
# When you hook this all into your webserver, you would tell your 
# webserver that the /static/ url maps to this directory so that 
# your app can find the static content. It's a directory in your
# project usually.
# it's a single directory where the static files are collected together.
STATIC_ROOT 

Leave a comment