migrate celery settings to BROKER_URL

This commit is contained in:
j 2014-11-26 21:03:27 +01:00
parent 274a8ffcca
commit 35d978d4c2
3 changed files with 22 additions and 6 deletions

View file

@ -170,11 +170,8 @@ DATABASES = {
#rabbitmq connection settings
CELERY_RESULT_BACKEND = "database"
BROKER_HOST = "127.0.0.1"
BROKER_PORT = 5672
BROKER_USER = "pandora"
BROKER_PASSWORD = "box"
BROKER_VHOST = "/pandora"
BROKER_URL = 'amqp://pandora:box@localhost:5672//pandora'
SEND_CELERY_ERROR_EMAILS = False
#with apache x-sendfile or lighttpd set this to True

View file

@ -102,6 +102,25 @@ if __name__ == "__main__":
run('./bin/pip', 'install', '-r', 'requirements.txt')
if old < 4379:
run('./bin/pip', 'install', '-r', 'requirements.txt')
if old < 4549:
import pandora.settings
with open('pandora/local_settings.py', 'r') as f:
local_settings = f.read()
if not 'BROKER_URL' in local_settings:
broker_url = 'amqp://%s:%s@%s:%s/%s' % (
getattr(pandora.settings, 'BROKER_USER', 'pandora'),
getattr(pandora.settings, 'BROKER_PASSWORD', 'box'),
getattr(pandora.settings, 'BROKER_HOST', '127.0.0.1'),
getattr(pandora.settings, 'BROKER_PORT', 5672),
getattr(pandora.settings, 'BROKER_VHOST', '/pandora'),
)
local_settings = [
l for l in local_settings.split('\n') if not l.startswith('BROKER_')
] + [
'BROKER_URL = "%s"' % broker_url, ''
]
with open('pandora/local_settings.py', 'w') as f:
f.write('\n'.join(local_settings))
else:
if len(sys.argv) == 1:

View file

@ -128,7 +128,7 @@ DATABASES = {
'PASSWORD': '',
}
}
BROKER_PASSWORD = "$RABBITPWD"
BROKER_URL = 'amqp://pandora:$RABBITPWD@localhost:5672//pandora'
XACCELREDIRECT = True
DEBUG = False