forked from drpancake/dramatiq-dashboard-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
executable file
·23 lines (18 loc) · 673 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3
import os
import bjoern
import dramatiq
from dramatiq.brokers.redis import RedisBroker
from dramatiq_dashboard import DashboardApp
REDIS_URL = os.environ['REDIS_URL']
REDIS_QUEUES = os.environ.get('REDIS_QUEUES', 'default')
REDIS_NAMESPACE = os.environ.get('REDIS_NAMESPACE', 'default')
PORT = int(os.environ.get('PORT', 8080))
HOST = os.environ.get('HOST', '0.0.0.0')
broker = RedisBroker(url=REDIS_URL, namespace=REDIS_NAMESPACE)
for queue in REDIS_QUEUES.split(','):
broker.declare_queue(queue)
dramatiq.set_broker(broker)
app = DashboardApp(broker=broker, prefix='')
print(f'Starting @ http://{HOST}:{PORT}')
bjoern.run(app, HOST, PORT)