Im pretty new to using flask and when trying to run my webapp I get the following error:
File "C:\Users\\Desktop\Flask\\Project\__init__.py", line 24, in create_app
from .models import User
File "C:\Users\\Desktop\Flask\\Project\models.py", line 1, in <module>
from db import db
File "c:\users\\appdata\local\programs\python\python38-32\lib\site-packages\db\__init__.py", line 69
print "var", var
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("var", var)?
This is my code:
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask import Blueprint
from flask_jwt_extended import (
JWTManager)
import jwt
db = SQLAlchemy()
def create_app():
app = Flask(__name__)
jwt = JWTManager(app)
app.config['SECRET_KEY'] = 'altman'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.sqlite'
app.config['JWT_COOKIE_CSRF_PROTECT'] = False
app.config['JWT_TOKEN_LOCATION'] = ['cookies']
app.config["JWT_ACCESS_COOKIE_NAME"] = "Info"
db.init_app(app)
from .models import User
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
from .api import auth as auth_blueprint
app.register_blueprint(auth_blueprint)
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
return app
This is the code for init.py. When running the webapp I get the error listed above. However ive been searching and found no solution.There is no line 69 in init.py and no print. Please help me out. Ive been trying to find the error for this the past couple of days and found no help. If needed I cna provide more code. Thanks :)