I can not even get off the ground with this one. Flask is not my first framework, but it is new to me since so many updates have went by. ok, so my problem is that I am running into this error when I am running my python file within the cli to import the db variable to work with it using sqlite.
>>> from __init__ import db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\*myusername*\Desktop\*appname*\__init__.py", line 2, in <module>
from sqlalchemy import SQLAlchemy
ImportError: cannot import name 'SQLAlchemy' from 'sqlalchemy' (C:\Users\*myusername*\Envs\*appname*\lib\site-packages\sqlalchemy\__init__.py)
My code is listed below, it isn't much but this is all I like from finishing my project. If anyone has any pointers here let me know. I am guessing it's something simple (it usually is) that I am just overlooking.
from flask import Flask, render_template
from sqlalchemy import SQLAlchemy
app = Flask('*appname*')
# Database functionality
app.config['SQLALCHEMY_DATABASE_URI']= 'sqlite:///C:/Users/*myusername*/Desktop/*appname*/'
db = SQLAlchemy(app)
class usersTable(db.Model):
userid = db.Column(db.Integer, primary_key=True)
fname = db.Column(db.Text)
lname = db.Column(db.Text)
email = db.Column(db.LargeBinary)
username = db.Column(db.LargeBinary)
password = db.Column(db.LargeBinary)
joined = db.Column(db.Date)
Thanks in advance guys. Normally my backend language is PHP, so I am branching out and this is really starting to get on my nerves lol.