What are the differences of these three static url?
I am not sure if I am right, I am using the
js = ('/admin/custom.js', )
STATIC_ROOT = "/home/user/project/django1/top/listing/static"
STATICFILES_DIRS = "/home/user/project/django1/top/listing/static"
You can find a definition for each of these settings in the documentation. Here is a quick definition (of my own) and a quotation of the doc, for each:
MEDIA_ROOT is the folder where every files uploaded with an
FileField will go.
Absolute filesystem path to the directory that will hold user-uploaded files.
STATIC_ROOT is the folder where every static files will be stored after a
The absolute path to the directory where
collectstaticwill collect static files for deployment.
staticfilescontrib app is enabled (default) the
collectstaticmanagement command will collect static files into this directory. See the howto on managing static files for more details about usage.
STATICFILES_DIRS is the list of folder where Django will search for additional static files, in addition to each
static folder of each app installed.
This setting defines the additional locations the staticfiles app will traverse if the
FileSystemFinderfinder is enabled, e.g. if you use the
findstaticmanagement command or use the static file serving view.
In your setting, you should have:
MEDIA_ROOT = os.path.join(BASE_DIR, "media/") STATIC_ROOT = os.path.join(BASE_DIR, "static/") STATICFILES_DIRS = ("/home/user/project/django1/top/listing/static", ) # Make a tuple of strings instead of a string
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))), as defined in the default Django
settings.py template now.