Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test for RabbitMQ settings before using.

  • Loading branch information...
commit c498c548cf0e97d24877822b78ffb7cce537d264 1 parent e4b8e65
@calumhalcrow calumhalcrow authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 chat/chatroom.py
View
6 chat/chatroom.py
@@ -53,7 +53,7 @@ def __init__(self):
# amqp://uname:pwd@host.heroku.srs.rabbitmq.com:13029/vhost
def connection_parameters(self):
- connection_parameters = settings.RABBITMQ_CONN
+ connection_parameters = {}
if ('RABBITMQ_URL' in os.environ):
rabbitmq_url = urlparse(os.environ['RABBITMQ_URL'])
@@ -67,6 +67,10 @@ def connection_parameters(self):
rabbitmq_url.password)
if rabbitmq_url.path:
connection_parameters['virtual_host'] = rabbitmq_url.path
+ elif (hasattr(settings, 'RABBITMQ_CONN')):
+ connection_parameters = settings.RABBITMQ_CONN
+ else:
+ raise Exception("Cannot find RabbitMQ connection parameters from os.environ or settings.")
return connection_parameters
Please sign in to comment.
Something went wrong with that request. Please try again.