-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
34 lines (25 loc) · 784 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
import os
from flask import Flask
from flask_cors import CORS
from flask_session import Session
from routes.index import user_blueprint
from config import Config
from dotenv import load_dotenv
load_dotenv()
app = Flask(__name__)
print("CLIENT_URI:", os.getenv("CLIENT_URI"))
cors_options = {
"supports_credentials": True,
"origins": [f"{os.getenv('CLIENT_URI')}"], # Your HTTP frontend
"methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
"allow_headers": ["Content-Type", "Authorization", "X-Requested-With"],
}
CORS(app, **cors_options)
# Load configuration
app.config.from_object(Config)
# Initialize session
Session(app)
# Register Blueprints
app.register_blueprint(user_blueprint, url_prefix="/api")
if __name__ == "__main__":
app.run(debug=True)