1. Create a python package named static in the root directory of the django project , or in the app
2. Change the settings.py file of the project
STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), )
STATIC_URL = '/static/'
The static is the alias of the absolute path of the static file, which is different from the package name static. The package name can be named arbitrarily. When calling static files, only aliases can be used .- The advantage of this is that the static in it can be changed at will with later changes,
STATICFILES_DIRS
and of course the corresponding package name should also be changed.