Lerndatenbank/lernplattform/__init__.py

22 lines
1.1 KiB
Python

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# Initialize a new Flask app instance with the name of the current module (main).
app = Flask(__name__)
# Set the secret key for this application. This is required for session management in Flask.
# The secret key should be a cryptographically secure random value, and it's used to sign cookies.
# For more information: https://flask.palletsprojects.com/en/2.3.x/config/#SECRET_KEY
app.secret_key = 'faab0674dd8d9a4554cbeb53da2dad1414cc4c64b778e282da0b1662df7e0f85'
# Configure the database URI for SQLAlchemy. Here, it uses an SQLite database named 'learn.db'.
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///learn.db'
# Disable tracking modifications to the database, which is not necessary in this case and can improve performance.
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# Initialize SQLAlchemy with the Flask app instance for database management.
db = SQLAlchemy(app)
# Import the routes module from the lernplattform package, which is assumed to be in the same directory.
import lernplattform.routes