20 lines
494 B
Python
20 lines
494 B
Python
from flask import Flask
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
db = SQLAlchemy()
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
app.config['SECRET_KEY'] = 'your_secret_key'
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.db'
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
|
|
db.init_app(app)
|
|
|
|
from .routes import bp
|
|
app.register_blueprint(bp)
|
|
|
|
with app.app_context():
|
|
db.create_all() # Create database tables if they don't exist
|
|
|
|
return app |