django-serverconfig is a Django app which creates useful configs with management commands
Install:
Buildout:
buildout.cfg: ::
`````````````
[buildout]
parts = ...
django-config
make-config
[django]
extra-paths = ...
${django-config:location}
[django-config]
recipe = zerokspot.recipe.git
repository = git://verne.redsolution.ru/django-config.git
[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
sudo bin/django make_config init.d > bin/init.d
sudo bin/django make_config lighttpd > bin/lighttpd
sudo bin/django make_config logrotate > bin/logrotate
sudo bin/django make_config monit > bin/monit
sudo chown root:root bin/init.d bin/lighttpd bin/logrotate bin/monit
sudo chmod ug=rwx,o=rx bin/init.d
sudo chmod ug=rw,o=r bin/lighttpd bin/logrotate bin/monit
echo Configs were saved to "bin/"
develop.cfg: ::
````````````
[make-config]
cmds =
settings.py ::
```````````
INSTALLED_APPS = (
...
'config',
)
...
# django-config settings
CONFIG_SITES = ['www.project-name.com', ]
CONFIG_REDIRECTS = ['project-name.com', ]
CONFIG_APP_MEDIA = {
# 'application-name': [
# ('media-root', 'media-url', ),
# ]
}
urls.py ::
```````
...
if settings.DEBUG:
urlpatterns += patterns('', (r'^', include('config.urls')))
urlpatterns += patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)
...
Apply on server
init.d: ::
``````
$ sudo ln -s /var/sites/< project-name >/bin/init.d /etc/init.d/< project-name >
lighttpd: ::
````````
$ sudo ln -s /var/sites/< project-name >/bin/lighttpd /etc/lighttpd/conf-available/11-< project-name >.conf
$ sudo ln -s /etc/lighttpd/conf-available/11-< project-name >.conf /etc/lighttpd/conf-enabled/11-< project-name >.conf
$ sudo invoke-rc.d lighttpd reload
logrotate: ::
`````````
$ sudo ln -s /var/sites//bin/logrotate /etc/logrotate.d/< project-name >
monit: ::
`````
$ sudo ln -s /var/sites/< project-name >/bin/monit /etc/monit/services-available/< project-name >
$ sudo ln -s /etc/monit/services-available/< project-name > /etc/monit/services-enabled/< project-name >
$ sudo monit reload
Product's homepage
Requirements:
· Python
· Django