Study/app.py

27 lines
799 B
Python
Raw Normal View History

2024-11-20 12:37:58 +08:00
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:805345@localhost/article_management'
db = SQLAlchemy(app)
bcrypt = Bcrypt(app)
login_manager = LoginManager(app)
login_manager.login_view = 'auth.login'
from routes.auth import auth_bp
from routes.articles import articles_bp
from routes.comments import comments_bp
from routes.admin import admin_bp
app.register_blueprint(auth_bp, url_prefix='/auth')
app.register_blueprint(articles_bp, url_prefix='/articles')
app.register_blueprint(comments_bp, url_prefix='/comments')
app.register_blueprint(admin_bp, url_prefix='/admin')
if __name__ == '__main__':
app.run(debug=True)