-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
36 lines (25 loc) · 853 Bytes
/
run.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
import optparse
from confs.development import development_config
from confs.local import local_config
from confs.production import production_config
from src import create_app
from src.resources.security import ErtisSecurityManager
CONFIG_LOOKUP = {
'local': local_config,
'development': development_config,
'production': production_config
}
parser = optparse.OptionParser()
parser.add_option("--config", default="production")
def config_settings():
options, _ = parser.parse_args()
return CONFIG_LOOKUP[options.config]
settings = config_settings()
app = create_app(settings)
app.security_manager = ErtisSecurityManager(app.db)
app.debug = settings['debug']
app.secret_key = settings['application_secret']
app.port = settings['port']
app.env = settings['environment']
if __name__ == '__main__':
app.run(port=app.port)