2017-07-25 09:52:24 +02:00
|
|
|
from flask import Flask
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from sqlalchemy import MetaData
|
|
|
|
from flask_migrate import Migrate
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
2017-07-26 11:11:54 +02:00
|
|
|
default_config = {
|
|
|
|
"SQLALCHEMY_TRACK_MODIFICATIONS": False,
|
|
|
|
"SQLALCHEMY_DATABASE_URI": "postgresql+psycopg2:///forget",
|
2017-07-27 20:20:59 +02:00
|
|
|
"SECRET_KEY": "hunter2",
|
|
|
|
"CELERY_BROKER": "amqp://",
|
2017-07-30 14:08:37 +02:00
|
|
|
"HTTPS": True
|
2017-07-26 11:11:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
app.config.update(default_config)
|
|
|
|
|
|
|
|
app.config.from_pyfile('config.py', True)
|
2017-07-25 23:05:46 +02:00
|
|
|
|
2017-07-25 09:52:24 +02:00
|
|
|
metadata = MetaData(naming_convention = {
|
|
|
|
"ix": 'ix_%(column_0_label)s',
|
|
|
|
"uq": "uq_%(table_name)s_%(column_0_name)s",
|
|
|
|
"ck": "ck_%(table_name)s_%(constraint_name)s",
|
|
|
|
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
|
|
|
|
"pk": "pk_%(table_name)s"
|
|
|
|
})
|
|
|
|
|
|
|
|
db = SQLAlchemy(app, metadata=metadata)
|
|
|
|
migrate = Migrate(app, db)
|