1
Hello,
I’m trying to run the remote: flask db init
, but the traceback returns:
main/app/Extensions/migrate.py:
from flask_migrate import Migrate
from main.extensions.sqlalchemy import db
migrate = Migrate()
def init_app(app):
migrate.init_app(app, db)
main/app/Extensions/dynaconf.py:
from importlib import import_module
from dynaconf import FlaskDynaconf
def load_extensions(app):
for extension in app.config.get('EXTENSIONS'):
module = import_module(extension)
module.init_app(app)
def init_app(app):
FlaskDynaconf(app)
main/app/app.py:
from flask import Flask
from main.extensions import dynaconf
_SECRET_KEY = None
def create_app():
app = Flask(__name__)
dynaconf.init_app(app)
dynaconf.load_extensions(app)
_SECRET_KEY = app.config.get('SECRET_KEY')
return app
Does not scroll, if I do this will scroll Circular Import and run to. The load_extensions function initializes all modules within app.
– Urich Oliveira
you are also programming in the style that the object oriented only that in structured language, flask is object oriented, can use the creation of classes to have resources as constructor, which you did in init_app
– Lucas Gabriel