在你的网站上的每一页上标记一个指示文字或图像
django-site-tag的Python项目详细描述
Django站点标记
django site tag允许您在网站的每个页面上设置“tags”,以指示当前环境、developemnt阶段或您可能希望使用此类功能的任何其他内容。
安装
pip install git+https://github.com/yudori/django-site-tag.git
设置
安装后,将django_site_tag
应用程序名称添加到已安装的应用程序列表中。
INSTALLED_APPS=[...# django apps'django_site_tag',...# custom apps]
将站点标记中间件添加到中间件列表中。
MIDDLEWARE=[...# django middleware list'django_site_tag.middleware.SiteTagMiddleware',...# custom middleware list]
定制
通过django设置提供自定义选项。设置以下任意值以将自定义设置添加到站点标记。
Setting Name | Type | Description | Example Value |
---|---|---|---|
^{ | string | space-separated css position values in the order: top, right, bottom ,left representing the position of the site tag | '15px 0px 0px 15px' |
^{ | string | The text to be written on the tag | 'TEST' |
^{ | string | The css style to be applied to the text | 'padding: 10px;' |
^{ | string | The css style to be applied to the border around the text | '2px dashed #ff0000;' |
^{ | string | The url to the image file to be used instead of text | '/static/images/tag.jpg' |