diff options
author | Markus Zapke-Grùˆndemann <markus@keimlink.de> | 2012-02-08 19:59:22 +0100 |
---|---|---|
committer | Markus Zapke-Grùˆndemann <markus@keimlink.de> | 2012-02-08 19:59:22 +0100 |
commit | 7d96ecbe3054c3a913cc401fa13fe54aa376598c (patch) | |
tree | bf0ed106cc00c0d02fe616ed367627d57e3f441f | |
parent | 7090b824f3cdc11dc918b252654808d4f3bfc880 (diff) |
introduce django-supervisor
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README.rst | 11 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | sublab_project/settings.py | 1 | ||||
-rw-r--r-- | sublab_project/supervisord.conf | 33 |
5 files changed, 40 insertions, 8 deletions
@@ -1,6 +1,8 @@ *.db *.log +*.pid *.pyc +*.rdb *.swp media sublab_project/local_settings.py @@ -59,15 +59,10 @@ Finally start the development webserver:: (sublab_website)$ ./manage.py runserver -To run the task queue you need to start Redis first. Then start the Celery_ -daemon in a new terminal:: +To use the task queue you need to have redis-server installed. Use supervisord +to start the Celery_ daemons, redis-server and runserver with one command:: - (sublab_website)$ ./manage.py celeryd -B -E -l info - -To be able to see the tasks in the Django admin you need to start -``celerycam`` in a third terminal:: - - (sublab_website)$ ./manage.py celerycam + (sublab_website)$ ./manage.py supervisor License ======= diff --git a/requirements.txt b/requirements.txt index 5ffaf71..287d583 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,4 @@ django-redisession==0.2 sorl-thumbnail==11.12 django-flatblocks==0.6.0 argparse==1.2.1 +django-supervisor==0.2.5 diff --git a/sublab_project/settings.py b/sublab_project/settings.py index 664a7d3..8eeb475 100644 --- a/sublab_project/settings.py +++ b/sublab_project/settings.py @@ -144,6 +144,7 @@ INSTALLED_APPS = ( 'sublab_monitor', 'flatblocks', 'matekarte', + 'djsupervisor' ) # A sample logging configuration. The only tangible logging diff --git a/sublab_project/supervisord.conf b/sublab_project/supervisord.conf new file mode 100644 index 0000000..c940dfd --- /dev/null +++ b/sublab_project/supervisord.conf @@ -0,0 +1,33 @@ +[program:gunicorn] +command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py run_gunicorn +{% if settings.DEBUG %} +exclude=true +{% endif %} + +{% if not settings.DEBUG %} +[program:runserver] +exclude=true +{% endif %} + +[program:celeryd] +{% if settings.DEBUG %} +command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celeryd -E --loglevel=INFO +{% else %} +command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celeryd -E +{% endif %} +directory={{ PROJECT_DIR }} +numprocs=1 +startsecs=5 +; Need to wait for currently executing tasks to finish at shutdown. +; Increase this if you have very long running tasks. +stopwaitsecs = 600 + +[program:celerycam] +command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celerycam + +[program:redis] +{% if settings.DEBUG %} +command=redis-server +{% else %} +command=redis-server +{% endif %} |