0

Firstly, I have searched Yahoo and haven't found a good answer.

All the Flask SQLAlchemy tutorials use SQLite, but from what I read SQLite isn't really good with Heroku - or at least a Yahoo search of SQLite Heroku - reveals many issues with it?

If there aren't in fact any issues with using SQLite, please let me know.

How do I set a database up with Postgres and FlaskSQLAlchemy - since from my research that is what Heroku supports?

1 Answer 1

1

Using Flask-SQLAlchemy, you can just do this:

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://username:password@host/dbname'
db = SQLAlchemy(app)

Now you can use this db object to do whatever you need.

Read here for more: http://packages.python.org/Flask-SQLAlchemy/config.html#configuration-keys

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.