AYohannes
AYohannes

Reputation: 625

"(Background on this error at: http://sqlalche.me/e/e3q8)"

I'm trying to get the user to submit a form on the homepage and then save that form to a SQL database. However, when the user submits the form, I get the following error: (Background on this error at: http://sqlalche.me/e/e3q8)

This is my __int__.py:

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager

app = Flask(__name__)
app.config['SECRET_KEY'] = '5791628bb0b13ce0c676dfde280ba245'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'

db = SQLAlchemy(app)
bcrypt = Bcrypt(app)

login_manager = LoginManager(app)
login_manager.login_view = 'login'
login_manager.login_message_category = 'info'

from flaskblog1 import routes

Upvotes: 11

Views: 68851

Answers (2)

X coder
X coder

Reputation: 55

I had the same problem and it was the database path that had to be changed.

Replace:

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'

by:

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'

Upvotes: 0

AYohannes
AYohannes

Reputation: 625

I found my problem I didnt create my data base db.create_all()

Upvotes: 5

Related Questions