1 year ago

#343697

test-img

efrwthy

I am trying to run flask-migrate and am encountering some problems. It says I have 1 more then 1 database even though I have 1. How do I fix this?

Here is the error I am getting.

 C:\Users\n\.virtualenvs\flaskblog2-leL8dPgn\lib\site-packages\flask_sqlalchemy\__init__.py:851: UserWarning: Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. Defaulting SQLALCHEMY_DATABASE_URI to "sqlite:///:memory:".
  warnings.warn(
C:\Users\n\.virtualenvs\flaskblog2-leL8dPgn\lib\site-packages\flask_sqlalchemy\__init__.py:872: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  warnings.warn(FSADeprecationWarning(

In my code SQLALCHEMY_TRACK_MODIFICATIONS is set to False. Why am I getting the error?

Also I googled SQLALCHEMY_BINDS.

This means I have 2 databases. But I only had 1 database. I have test.db. Does migrate folder also count as database?

I am following the documentation for flask and am still getting the errors. Here is the documentation.

https://flask-migrate.readthedocs.io/en/latest/

Also I am getting an operational error when I try to register a user. I assume after I migrate the database I have to create the database using

from app import db,create_app
from app.models import User , Posts, Followers 
app = create_app()
with app.app_context():
    db.create_all()

is this correct?

Thanks for the help

Thanks

I followed the documentation from https://flask-migrate.readthedocs.io/en/latest/.

My app looks like https://github.com/CoreyMSchafer/code_snippets/tree/master/Python/Flask_Blog/11-Blueprints except I added the correct code from flask-migrate documentation.

python

flask

flask-sqlalchemy

flask-migrate

0 Answers

Your Answer

Accepted video resources