-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
36 lines (27 loc) · 818 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
35
36
import os
from flask import Flask
from flask_cors import CORS
from flask_smorest import Api
from cache import init_cache_app
from rate_limiter import init_rate_limiter
from config import CONFIG
from errors import bp as errors_bp
from index import bp as index_bp
def create_app():
app = Flask(__name__)
app.config.update(CONFIG)
CORS(app, resources={
# update to FE or production link
r"/*": {"origins": ["http://localhost:3000", "https://example.com"]}
})
api = Api(app)
api.register_blueprint(index_bp)
api.register_blueprint(errors_bp)
init_cache_app(app)
init_rate_limiter(app)
return app
if __name__ == "__main__":
app = create_app()
app.run(debug=True,
host="0.0.0.0",
port=int(os.environ.get("PORT", 8080)))