Created
April 9, 2012 13:45
-
-
Save arruda/2343490 to your computer and use it in GitHub Desktop.
Django-Celery In Daemon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install rabbitmq-server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name of nodes to start, here we have a single node | |
CELERYD_NODES="w1" | |
# Where to chdir at start. | |
CELERYD_CHDIR="/var/www/some_folder/Myproject/" | |
# Python interpreter from environment, if using virtualenv | |
ENV_PYTHON="/somewhere/.virtualenvs/MyProject/bin/python" | |
# How to call "manage.py celeryd_multi" | |
CELERYD_MULTI="$ENV_PYTHON $CELERYD_CHDIR/manage.py celeryd_multi" | |
# How to call "manage.py celeryctl" | |
CELERYCTL="$ENV_PYTHON $CELERYD_CHDIR/manage.py celeryctl" | |
# Extra arguments to celeryd | |
CELERYD_OPTS="--time-limit=300 --concurrency=8" | |
# Name of the celery config module, don't change this. | |
CELERY_CONFIG_MODULE="celeryconfig" | |
# %n will be replaced with the nodename. | |
CELERYD_LOG_FILE="/var/log/celery/%n.log" | |
CELERYD_PID_FILE="/var/run/celery/%n.pid" | |
# Workers should run as an unprivileged user. | |
CELERYD_USER="celery" | |
CELERYD_GROUP="celery" | |
# Set any other env vars here too! | |
PROJET_ENV="PRODUCTION" | |
# Name of the projects settings module. | |
# in this case is just settings and not the full path because it will change the dir to | |
# the project folder first. | |
export DJANGO_SETTINGS_MODULE="settings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to start celeryd | |
/etc/init.d/celeryd start | |
# to stop | |
/etc/init.d/celeryd stop | |
# see the status | |
/etc/init.d/celeryd status | |
# print the log in the screen | |
cat /var/log/celery/w1.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install django-celery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python manage.py celeryd -l info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
#very important to have this next two lines! | |
import djcelery | |
djcelery.setup_loader() | |
BROKER_HOST = "localhost" | |
BROKER_PORT = 5672 | |
BROKER_USER = "guest" | |
BROKER_PASSWORD = "guest" | |
BROKER_VHOST = "/" | |
installed_apps+=('djcelery',) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do I put the conf.sh?