-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
28 lines (20 loc) · 775 Bytes
/
main.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
import argparse
import os
from flask import Flask
from flask_restful import Api
from waitress import serve
from settings.config import logger
from settings.routes import routes
app = Flask(__name__)
app.config.from_object(os.getenv('CONFIG_TYPE'))
logger.info(f"Running {app.config['FLASK_ENV'].upper()} Server")
api = Api(app)
routes(api)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--host', help='Host_Address', required=False)
parser.add_argument('--port', help='Port_Number', required=False)
args = vars(parser.parse_args())
serve(app, host=args['host'] if args['host'] else app.config['HOST'],
port=args['port'] if args['port'] else app.config['PORT'],
server_name='calculator_app')