Package: redsolutioncms.django-server-config
Adds management command to make configs for your project.
Now it can generate config for lighttpd, logrotate, monit and deploy scripts.Automatically recognizes media directories in 3-party applications and takes them into account.Installation:In settings.py:Putconfigto yourINSTALLED_APPS.Set domain names for your projectCONFIG_SITES = ['www.project-name.com', ]Domains for which you want redirects to your siteCONFIG_REDIRECTS = ['project-name.com', ]Serving static filesSet path to media for unusual 3-party applicationCONFIG_APP_MEDIA = {
    'application-name': [
        ('media-root', 'media-url', ),
    ]
}Media folders with same name as application modulde will be added     automatically.
For example, intinymcemodule media filestinymce/
    media/
        tinymce/
            js/tinymce.js
            css/style.csswill be available at url:/media/tinymce/js/tinymce.js
/media/tinymce/css/style.jsStop! Aren’t Django staticfiles do that?Yes, they do. But django-servre-config is older than staticfiles and does same job. This feature will is deprecated and will not be supported since 0.2.x release. We recommend to use Django contrib applicationdjango.contrib.statifiles. Read below about how to do it.In urls.py:If you usedjango-server-configfor serving static media, add following code to the urls.py for serve static files in debug mode. Add it BEFOREdjango.views.static.serveif settings.DEBUG:
    urlpatterns += patterns('', (r'^', include('config.urls')))In buildout.cfg:If you are using zc.buildout, you can add to your partsmake-configto make config files automaticaly:[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/"Without bulidoutIf you are not using zc.buildlout, you can add to repository shell script with commands above, it will give same effect.Staticfiles supportSince 0.1.1 server-config supportsdjango.contrib.staticfilesandstaticfilesapps. If one of them present inINSTALLED_APPS, config for webserver will be generated with appropriate rewrite rule.Ifstaticfilesis used there is no need to includeconfig.urlsinurlconf.py. On the other hand, probably you will want to includestaticfiles_urlpatterns()from staticfiles app (see:django documentationabout it)from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()Duply/Duplicity backupsDjango-server-config can automatically create backups configuration files.
It supportsduply(duplicity) configuration scheme.
Duplicity is backup system written in python and using rsync algorithm and Duply is bash configuration wrapper for Duplicity.Backup settingsSecurity NoteTo start using backups you should specify path to main configuration file for duply. Django-server-config expects file in*.iniformat. This file
can contains secret passwords, so file supposed to be located somewhere in/etc/duply/conf.iniand belongs to root (superuser).BACKUP_DUPLY_CONFIGPath to duply configuration fileBACKUP_TEMP_DIRTemp directory, where database backups will be located. Database dumps will be deleted from file system after each backup session. Default value:'/var/backups/postgres'Only PostgreSQL database backups are supported!Duply configuration fileIt is quite simple to configure duply.
You can create duply initial config simply from command line::duply <profile> createThen look at ~/.duply/<profile>/conf and follow comments.Moreover, you can use ours config template:[duply]
GPG_PW='**********'
TARGET='s3+http://**********@com.mycompany.server/'
SOURCE='/'
MAX_AGE=1M
MAX_FULL_BACKUPS=5
MAX_FULLBKP_AGE=1W
VOLSIZE=50
DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE --volsize $VOLSIZE "This template encrypts backups with GPG and uplaod to AmazonS3 bucketcom.mycompany.server.Pay attention to theTAGEToption. Django-server-config willautomatiocallyadd project_name toTARGET. E.g. rendered config will contain value:TARGET = s3+http://**********@com.mycompany.server/<myproject>Consider trailing slash in*.iniconfig, django-server-config adds onlymyprojectwithout slash.History0.1.0 - Initial commit0.1.1 - Staticfiles support added0.1.2 - Duply backups support0.1.3 - Emergency lighttpd config fix (staticfiles didn’t work), don’t use v0.1.1!0.1.4 - Backup config bugfixesClassifiers:Utilities