settings.py
import os import sys
from app import app
SQLite URI compatible
WIN = sys.platform.startswith('win') if WIN: prefix = 'sqlite:///' else: prefix = 'sqlite:////'
dev_db = prefix os.path.join(os.path.dirname(app.root_path), 'data.db')
SECRET_KEY = os.getenv('SECRET_KEY', 'secret string') SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URI', dev_db)
app.py
app = Flask('sayhello') app.config.from_pyfile('settings.py')