53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
import json
|
|
import os
|
|
|
|
from Auth import auth_bp
|
|
from flask import Flask, redirect, render_template, session
|
|
from Report import report_bp
|
|
from Requests import requests_bp
|
|
from Waybill import waybill_bp
|
|
|
|
app = Flask(__name__)
|
|
app.secret_key = "suplex"
|
|
|
|
app.config.update(
|
|
db_config=json.load(
|
|
open(
|
|
os.path.join(os.path.dirname(__file__), "data/config.json"),
|
|
encoding="utf-8",
|
|
)
|
|
),
|
|
db_access=json.load(
|
|
open(
|
|
os.path.join(os.path.dirname(__file__), "data/db_access.json"),
|
|
encoding="utf-8",
|
|
)
|
|
),
|
|
cache_config=json.load(
|
|
open(
|
|
os.path.join(os.path.dirname(__file__), "data/redis_config.json"),
|
|
encoding="utf-8",
|
|
)
|
|
),
|
|
)
|
|
|
|
app.register_blueprint(requests_bp, url_prefix="/requests")
|
|
app.register_blueprint(auth_bp, url_prefix="/auth")
|
|
app.register_blueprint(report_bp, url_prefix="/report")
|
|
app.register_blueprint(waybill_bp, url_prefix="/waybill")
|
|
|
|
|
|
@app.route("/")
|
|
def index():
|
|
return render_template("main_menu.html", ses=session)
|
|
|
|
|
|
@app.route("/logout")
|
|
def logout():
|
|
session.clear()
|
|
return redirect("/")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(port=5002, host="0.0.0.0")
|