组织django设置的助手。

django-configurations-x的Python项目详细描述


django配置图片::https://secure.travis ci.org/jezdez/django configurations.png
:alt:build status
:target:https://travis ci.org/jezdez/django configurations

django configurations通过依赖于python类的可组合性来简化django项目配置。它扩展了django的基于模块的设置加载的概念,使用了已经建立好的面向对象编程模式。_:http://django configurations.readthedocs.org/en/latest/




quickstart
--



install django configurations:

。代码块::console



,然后将包含的“configurations.configuration”类派生到
project的**settings.py**或用于存储
设置常量的任何其他模块中,例如:

。代码块::python

mysite/settings.py


代码块::console

export django_configuration=dev


and the``django_settings_module``环境变量到模块
照常导入路径,例如在bash中:

。代码块:console

export django_settings_module=mysite.settings

*或者*在使用django
管理命令时,按照django默认的``--settings`
命令行选项提供`--configuration``选项,例如::


例如,使用
django配置的典型**manage.py**如下:

…代码块::python
:强调行:10

/usr/bin/env python

import os
import sys

“dev”)

适用于您的**wsgi.py**文件,例如:

…代码块::python
:强调行:6


os.environ.setdefault('django_configuration','dev')


使用默认的“django.core.wsgi.getwsgi.application`
函数,而不是“configurations.wsgi.getwsgi.application`.

现在,您可以将项目与“manage.py”和您最喜欢的启用wsgi的服务器一起使用。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java IntelliJ找不到依赖项选项卡   java向字符串数组string[]添加元素并在Junit中测试结果   如何在eclipse中获取活动java项目的名称   如何使用java在mysql中插入时间   java ArrayList更新了插入一行,但Jtable仍然没有刷新   如何在JavaSwing中命名坐标(点)   java Matcher/模式不打印   java错误地设置了arraylist   使用UsernamePasswordCredential提供程序的java列表Azure AD   java在HTTP请求中设置UTC时间   未加载事件:jquery完整日历Java集成   java Maven插件依赖项无法从内部repo解析依赖项   Maven更新重置Java版本   java如何向中添加图片。带有Apache POI XWPF的docx,但不指定其大小   Java最大函数递归