Answer the question
In order to leave comments, you need to log in
Flask, how to correctly split a project into layouts using blueprint?
I want to divide the project into layouts.
Now the structure is:
Проект/
__init__.py
Приложение/
__init__.py
templates/
forms.py
views.py
from flask import Flask
from flask_login import LoginManager
from flask_mail import Mail
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from auth import auth
# инициализация приложений
app = Flask(__name__)
app.register_blueprint(auth, url_prefix='/')
app.config.from_object('config')
db = SQLAlchemy(app)
lm = LoginManager(app)
lm.login_view = 'login'
lm.login_message = 'Пожалуйста введите свои данные для входа на сайт, либо
зарегистрируйтесь'
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
mail = Mail(app)
bcrypt = Bcrypt(app)
from flask import Blueprint
auth = Blueprint('auth', __name__, template_folder='./templates')
from __init__ import app
app.url_map
Map([<Rule '/static/<filename>' (GET, OPTIONS, HEAD) -> static>])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question