django 静态文件配置
来源:互联网 发布:it服务管理平台 编辑:程序博客网 时间:2024/06/10 02:40
Websites generally need to serve additional files such as images, JavaScript, or CSS. In Django, we refer to these files as “static files”. Django provides django.contrib.staticfiles to help you manage them.
Configuring static files
Make sure that django.contrib.staticfiles is included in your INSTALLED_APPS.
In your settings file, define STATIC_URL, for example:
STATIC_URL = '/static/'
In your templates, either hardcode the url like /static/my_app/myexample.jpg or, preferably, use the static template tag to build the URL for the given relative path by using the configured STATICFILES_STORAGE storage (this makes it much easier when you want to switch to a content delivery network (CDN) for serving static files).
{% load staticfiles %}<img src="{% static "my_app/myexample.jpg" %}" alt="My image"/>
Store your static files in a folder called static in your app. For example my_app/static/my_app/myimage.jpg.
- Django静态文件配置
- django 静态文件配置
- Django静态文件配置
- Django静态文件配置
- django 配置静态文件
- Django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- django静态文件配置
- 办假机动车登记証书Q【983001888】记者証
- 直方图与匹配 - 直方图的计算与显示(cvCalcHist)
- background-position 用法详细介绍
- 项目中用到的设计模式:Reactor设计模式
- ORA-38706: Cannot turn on FLASHBACK DATABASE logging.
- django 静态文件配置
- JS formvalidator 表单验证试用
- ubuntu下安装英汉词典——stardict
- Linux串口编程
- Linux下简单Shell 脚本的写法
- 移植ntfs-3g到nuc960
- 百度竞价匹配方式
- MySQL的重装问题解决方法
- 强大的vim配置文件,让编程更随意