0

There is following structure:

-app.py --blueprints/feed.py at the app.py i has

app = Flask(__name__, template_folder="app/templates")
mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'root'
app.config['MYSQL_DATABASE_DB'] = 'dt-products'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)
app.register_blueprint(feed)

and now at feed.py module im trying to import mysql like that:

from app import mysql but it doesnt works. where i did mistake ?

thanks.

pshx
  • 19
  • 2

2 Answers2

0

Try this:

from ..app import mysql

Hope it helps!

Jahongir Rahmonov
  • 13,083
  • 10
  • 47
  • 91
0

Problem was that i had same name of app folder and app module, thats was a reason of importing issue.

pshx
  • 19
  • 2