forked from pdonorio/rest-mock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·35 lines (26 loc) · 864 Bytes
/
run.py
File metadata and controls
executable file
·35 lines (26 loc) · 864 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
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
RESTful API Python 3 Flask server
"""
import os
import better_exceptions as be
from rapydo.confs import PRODUCTION
from rapydo.utils.logs import get_logger
from rapydo.server import create_app
log = get_logger(__name__)
# The connection is HTTP internally to containers
# The proxy will handle HTTPS calls
# We can safely disable HTTPS on OAUTHLIB requests
# http://stackoverflow.com/a/27785830/2114395
if PRODUCTION:
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
#############################
# BE FLASK
app = create_app(name='REST_API')
if __name__ == "__main__":
log.debug("Server running (w/ %s)" % be.__name__)
# NOTE: 'threaded' option avoid to see
# angular request on this server dropping
# and becoming slow if not totally frozen
app.run(host='0.0.0.0', threaded=True)