KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
It seems common practice in Flask to start like this: from flask import Flask from flaskext.sqlalchemy import SQLAlchemy app = Flask(__name__) SQLALCHEMY_DATABASE_URI = 'something' app.config.from_object(__name__) db = SQLAlchemy(app) And then import and use app and db everywhere. But when you create db like this, it grabs configuration from the app, and it seems that this configuration can't ever be overridden once it happens. There are some pages on Flask's website about making application factories, but it's not clear how I would be able to still use app and db everywhere if I did that. How do I write a script to test my Flask application with a different database? How should I structure my application to make this possible? Do I have to use module s ?
Tags (comma-separated)
Save Edits
Cancel