Management of Django Basics static file Css,js,images:

Source: Internet
Author: User
Managing Static Files
  • CSS, pictures, js are static files in the project
Configuring Static Files
  • Defining static content in the settings file
STATIC_URL = ‘/static/‘STATICFILES_DIRS = [    os.path.join(BASE_DIR, ‘static‘),]
  • Create a static directory under the project root and create a directory for the current app name
mysite/static/myapp/
  • You can use hard-coded in templates
/static/my_app/myexample.jpg
  • Static encoding can be used in templates
{ % load static from staticfiles %}

Management of Django Basics static file Css,js,images:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.