-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
60 lines (43 loc) · 1.28 KB
/
manage.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from flask import current_app
from flask.ext.script import Manager, prompt_choices, Server
from flask.ext.script.commands import ShowUrls, Clean
import nose
import pprint
from main import app
from config import CONFIG
def create_app(debug, config=None):
app.debug = False
print("CONFIG", config)
import os
os.environ['DEBUG'] = 'true'
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = 'true'
if config is not None:
app.config.from_pyfile(config)
else:
app.config.from_object(CONFIG)
app.debug = debug
return app
manager = Manager(create_app)
@manager.command
def test():
"""Run tests"""
nose.run(argv=["-w ."])
@manager.command
def dumpconfig():
"""Dumps config"""
pprint.pprint(current_app.config)
manager.add_option("-c", "--config",
dest="config",
help="config file",
required=False)
manager.add_option("-d", "--debug",
dest="debug",
help="run in debug mode",
default=False)
manager.add_command("runservernoreload", Server(use_reloader=False))
manager.add_command("urls", ShowUrls())
manager.add_command("clean", Clean())
if __name__ == "__main__":
manager.run()