-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
34 lines (25 loc) · 954 Bytes
/
app.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
# Importing the necessary modules and libraries
import sys
import logging
from flask import Flask
from flask_cors import CORS
from src.routes.reorderRoutes import reorderBlueprint
def create_app():
# Allow CORS for all origins
app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}})
# Set up logging
logging.basicConfig(filename='app.log', level=logging.DEBUG)
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console_handler.setFormatter(formatter)
logging.getLogger().addHandler(console_handler)
# Registering the blueprint
app.register_blueprint(reorderBlueprint, url_prefix='/reorder')
return app
# Creating the app
app = create_app()
if __name__ == '__main__': # Running the app
app.run(host='127.0.0.1', port=3000, debug=True)