-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (24 loc) · 775 Bytes
/
app.py
File metadata and controls
33 lines (24 loc) · 775 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
from flask import Flask, redirect, url_for
from flask_cors import CORS
from dotenv import load_dotenv
import os
import logging
load_dotenv()
from endpoints import snake
from endpoints import user
app = Flask(__name__)
# Basic logging configuration
log_level = os.getenv('LOG_LEVEL', 'DEBUG')
logging.basicConfig(level=log_level)
# Allow CORS for local development
cors = CORS(app, resources={r"/*": {"origins": "http://localhost:*"}})
# Register endpoints
app.register_blueprint(snake)
app.register_blueprint(user)
@app.route('/')
def root():
return redirect(url_for('user.login'))
reload_templates = os.getenv('TEMPLATES_AUTO_RELOAD', 'False')
app.config['TEMPLATES_AUTO_RELOAD'] = reload_templates
if __name__ == '__main__':
app.run(debug=True, port=8080)