对于部署服务器安装很有用。添加管理命令以对项目进行配置。自动识别三方应用程序中的媒体目录

redsolutioncms.django-server-config的Python项目详细描述


安装:

在设置中。py:

  1. 配置 放到已安装的应用程序

  2. 为项目设置域名

    CONFIG_SITES = ['www.project-name.com', ]
    
  3. 要重定向到站点的域

    CONFIG_REDIRECTS = ['project-name.com', ]
    
  4. 提供静态文件

    < Buff行情>

    为不寻常的三方应用程序设置媒体路径

    CONFIG_APP_MEDIA = {
        'application-name': [
            ('media-root', 'media-url', ),
        ]
    }
    

    将自动添加与应用程序module同名的媒体文件夹。 例如,在 tinymce 模块媒体文件中

    tinymce/
        media/
            tinymce/
                js/tinymce.js
                css/style.css
    

    网址:

    /media/tinymce/js/tinymce.js
    /media/tinymce/css/style.js
    
  5. < > >

    住手!django staticfiles不是这么做的吗?

    是的,他们有。但是django servre config比staticfiles旧,并且做相同的工作。此功能将被弃用,并且自0.2.x版本起将不受支持。我们建议使用django contrib application django.contrib.statifiles 。请阅读下面的操作说明。

在url.py:

  1. 如果使用django服务器配置为静态媒体提供服务,请在调试模式下为静态文件提供服务的url.py中添加以下代码。在django.views.static.serve之前添加它

    if settings.DEBUG:
        urlpatterns += patterns('', (r'^', include('config.urls')))
    
  2. < > >

内置.cfg:

  1. 如果您使用的是zc.buildout,则可以将其添加到您的部件中,以使配置文件自动生成:

    [make-config]
    recipe = iw.recipe.cmd
    on_install = true
    on_update = true
    cmds = sudo rm -f bin/init.d bin/lighttpd bin/logrotate bin/monit bin/*.py
       bin/django make_config init.d > bin/init.d
       bin/django make_config lighttpd > bin/lighttpd
       bin/django make_config logrotate > bin/logrotate
       bin/django make_config monit > bin/monit
       # Enable backups with duply & duplicity (http://duplicity.nongnu.org)
       bin/django make_config duply_conf > bin/duply_conf
       bin/django make_config duply_pre > bin/duply_pre
       bin/django make_config duply_post > bin/duply_post
       bin/django make_config duply_exclude > bin/duply_exclude
    
       # Collect static automaticaly
       sudo rm -Rf static
       bin/django collectstatic -l ---noinput
       sudo chown www-data:www-data -R static
    
       bin/django make_config install.py > bin/install.py
       bin/django make_config uninstall.py > bin/uninstall.py
       bin/django make_config enable.py > bin/enable.py
       bin/django make_config disable.py > bin/disable.py
    
       sudo chown root:root bin/*
       sudo chmod ug=rw,o=r bin/*
       sudo chmod ug=rwx,o=rx bin/init.d bin/django bin/buildout
       echo Configs were saved to "bin/"
    
  2. < > >

    无球虫

    如果您不使用zc.buildlout,您可以使用上面的命令将其添加到存储库shell脚本中,它将产生相同的效果。

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

推荐PyPI第三方库


热门话题
java如何在sqlite数据库中保存特定列的历史记录   java如何更改/更新timeseriechart名称(JFreeChart)   java如何将整数转换为可绘制的   汇编什么解释Java的字节码   java查找已编译的类版本号   我应该什么时候在ColdFusion应用程序中使用Java?   java当一个实体的两个字段为(unique=true)时,如何处理JPA异常?   java为什么在所有其他实例都正确的情况下返回错误的布尔值?   java Hibernate每次都准备语句   java停留在平均字长上   对Java和日语字符进行编码   java如何将导致异常的方法的错误消息传递给侦听器中的onTestFailure方法   java代码没有打印结果   java为什么私有内部接口的方法必须是公共的?   休眠发生错误。有关详细信息,请参阅错误日志。JAVAlang.NullPointerException