-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
26 lines (20 loc) · 677 Bytes
/
Copy pathapp.py
File metadata and controls
26 lines (20 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from flask import Flask
import httpqueue.views.queue
import httpqueue.model
ENVVAR_NAME = 'HTTPQUEUE_SETTINGS'
MONGODB_HOST = 'localhost'
MONGODB_PORT = 27017
def make_app(config=None):
app = Flask(__name__)
if config:
app.config.from_object(config)
try:
app.config.from_envvar(ENVVAR_NAME)
except RuntimeError:
print ENVVAR_NAME, 'not set. Using default configuration.'
app.register_module(httpqueue.views.queue.view, url_prefix='/queue')
httpqueue.views.queue.view.logger = app.logger
httpqueue.model.init_model(app)
return app
if __name__ == '__main__': # pragma: no cover
make_app(__name__).run(debug=True)