getting-started-with-flask | Companion code for my tutorial , Getting | Learning library
kandi X-RAY | getting-started-with-flask Summary
kandi X-RAY | getting-started-with-flask Summary
This is the code that I used for my tutorial, Getting Started With Flask, published on Scotch.io.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of getting-started-with-flask
getting-started-with-flask Key Features
getting-started-with-flask Examples and Code Snippets
Community Discussions
Trending Discussions on getting-started-with-flask
QUESTION
I am following this tutorial: getting started with flask-login.
However I am stuck at step 5 where I start to use SQLAlchemy. I believe the problem might be circular importing, based on what I have read but I'm still a little new to Python coding. This web app is a little project I am doing in my free time.
So I guess my overall question is, is this circular importing, and if not does anyone see what I might be doing wrong here? I am also running this using virtualenv using Python 2.7.
File Structure:
...ANSWER
Answered 2018-Feb-13 at 09:58You are correct you have a circle import issue.
At app.py
you import from noteapp.models import db
,
and at models.py
you import from noteapp.app import app
A quick fix could be:
at models.py
use db = SQLAlchemy()
without the app
.
At the app.py
module, import db from models.py and do db.init_app(app)
also remove db = SQLAlchemy(app)
from your app.py
your app.py should look like this..
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install getting-started-with-flask
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page