django应用,实现主题化概念,灵活可配置。
django-template-theming的Python项目详细描述
安装
您可以使用pip:
安装最新的django模板主题版本pip install django-template-theming
设置
注意:应将以下设置添加到项目文件settings.py中。
将“主题化”添加到INSTALLED_APPS:
INSTALLED_APPS += ( 'theming', ) if using django-compressor make sure put theming before compressor
将“theming.middleware.themingMiddleware”添加到MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES += ( 'theming.middleware.ThemingMiddleware', )
将“theming.template.loader”添加到TEMPLATE_LOADERS:
TEMPLATE_LOADERS += ( 'theming.template.Loader', )
用法
它应该在项目中创建一个文件夹themes,其结构如下:
django_project/ | -- themes/ | -- default/ ** theme name | -- static/ ** will collected by `collectstatic` management command | | -- styles/ | | -- scripts/ | | -- images/ | -- templatefiles and folders
贡献
开发django模板主题化的工作在github进行,任何想法和贡献都是源源不断的。 https://github.com/wtayyeb/django-template-theming