имеется структура:
app
auth
controllers.py
main
controllers.py
__init__.py
код __init__.py:
import os
from flask import Flask
from .db import db
def create_app():
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS'])
db.init_app(app)
with app.test_request_context():
db.create_all()
import app.auth.controllers as auth
import app.main.controllers as main
app.register_blueprint(auth.module)
app.register_blueprint(main.module)
return app
в обеих контроллерах:
from flask import (
Blueprint,
render_template,
request,
# flash,
abort,
redirect,
url_for,
current_app,
session
)
from sqlalchemy.exc import SQLAlchemyError
module = Blueprint('тут название модуля, либо main, либо auth', __name__, url_prefix ='/')
def log_error(*args, **kwargs):
current_app.logger.error(*args, **kwargs)
@module.route('/', methods=['GET'])
def index():
return None
Так вот, main отлично импортит, а вот если прописать auth в импорт:
Traceback (most recent call last):
File "./manage.py", line 7, in <module>
app = create_app()
File "/app/__init__.py", line 13, in create_app
import app.auth.controllers as auth
ImportError: No module named auth.controllers
В чем проблема то??