django static resources

  • Create a static resource storage path, in order to set a static media, you need to set up a directory to store them in your project directory (eg / myproject /), create a directory called the static of. Then create a directory of images and js directories in the static

 

 

  • Setting a static file directory project, the project settings.py file, we need to update two variables STATIC_URL and STATICFILES_DIRS tuple as create a variable to store static directory (STATIC_PATH) are as follows:

STATIC_URL = "/static/"
STATIC_PATH = os.path.join(BASE_DIR, "/static/")
STATICFILES_DIRS = ( STATIC_PATH,
)

  • Static resources ready, but also to the need to set django, django holding these static resources doing it? Of course, is to use a template html file ah

 

Guess you like

Origin www.cnblogs.com/igoodful/p/11482314.html