2024-11-13 02:49:43 +00:00
|
|
|
from flask import Flask
|
|
|
|
from routes import org_bp, user_bp, file_bp
|
|
|
|
from database import db_connection
|
2024-11-15 01:18:23 +00:00
|
|
|
from models import Organization, User, File, Session
|
2024-11-13 02:49:43 +00:00
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///database.db"
|
|
|
|
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
|
|
|
|
app.config["SQLALCHEMY_AUTOCOMMIT"] = False
|
|
|
|
app.config["SQLALCHEMY_AUTOFLUSH"] = False
|
|
|
|
db_connection.init_app(app)
|
|
|
|
with app.app_context():
|
|
|
|
db_connection.create_all()
|
|
|
|
|
|
|
|
app.register_blueprint(org_bp, url_prefix="/org")
|
|
|
|
app.register_blueprint(user_bp, url_prefix="/user")
|
|
|
|
app.register_blueprint(file_bp, url_prefix="/file")
|
|
|
|
|
2024-11-15 01:18:23 +00:00
|
|
|
@app.route("/reset")
|
|
|
|
def reset():
|
|
|
|
with app.app_context():
|
|
|
|
db_connection.drop_all()
|
|
|
|
db_connection.create_all()
|
|
|
|
return "Database reset"
|
|
|
|
|
2024-11-13 02:49:43 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
app.run(debug=True)
|