-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (26 loc) · 816 Bytes
/
app.py
File metadata and controls
33 lines (26 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from flask import Flask
from flask_bootstrap import Bootstrap5
from blog_bp.extensions import db, login_manager
from dotenv import load_dotenv
from flask_ckeditor import CKEditor
import os
# BLUEPRINTS
from blog_bp.static_views.routes import static_views
from blog_bp.blog.routes import blog
from blog_bp.users.routes import user_bp
app = Flask(__name__)
load_dotenv()
app.config['SECRET_KEY'] = os.getenv("SECRET_KEY")
ckeditor = CKEditor(app)
Bootstrap5(app)
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv("DB_URI")
db.init_app(app)
login_manager.init_app(app)
with app.app_context():
db.create_all()
# Register blueprint template
app.register_blueprint(static_views)
app.register_blueprint(user_bp)
app.register_blueprint(blog, url_prefix='/post')
if __name__ == '__main__':
app.run(debug=True)