30 lines
1006 B
Python
30 lines
1006 B
Python
from flask import Flask, render_template, session
|
|
from Requests.requests import requests_bp
|
|
from Auth.auth import auth_bp
|
|
from checker import check_auth
|
|
import os, json
|
|
|
|
app = Flask(__name__)
|
|
app.secret_key = 'suplex'
|
|
|
|
# app.config.from_file(os.path.join(os.path.dirname(__file__), 'data/db_access.json'), load=json.load)
|
|
# app.config.from_file(os.path.join(os.path.dirname(__file__), 'data/config.json'), load=json.load)
|
|
|
|
with open(os.path.join(os.path.dirname(__file__), 'data/db_access.json')) as f:
|
|
app.config['db_access'] = json.load(f)
|
|
with open(os.path.join(os.path.dirname(__file__), 'data/config.json')) as f:
|
|
app.config['db_config'] = json.load(f)
|
|
|
|
app.register_blueprint(requests_bp, url_prefix='/requests')
|
|
app.register_blueprint(auth_bp, url_prefix='/auth')
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('main_menu.html', ses=session)
|
|
|
|
@app.route('/logout')
|
|
@check_auth
|
|
def logout():
|
|
session.clear()
|
|
return render_template('exit.html')
|
|
app.run(port=5001, debug=True) |