forget-cancellare-vecchi-toot/app.py

38 lines
1.0 KiB
Python
Raw Normal View History

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
2017-08-07 14:51:33 +02:00
import version
2017-07-25 09:52:24 +02:00
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-08-07 15:06:29 +02:00
"HTTPS": True,
"SENTRY_CONFIG": {}
2017-07-26 11:11:54 +02:00
}
app.config.update(default_config)
app.config.from_pyfile('config.py', True)
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)
2017-08-07 13:29:31 +02:00
sentry = None
if 'SENTRY_DSN' in app.config:
from raven.contrib.flask import Sentry
2017-08-07 15:09:28 +02:00
app.config['SENTRY_CONFIG']['release'] = version.version
2017-08-07 14:59:38 +02:00
sentry = Sentry(app, dsn=app.config['SENTRY_DSN'])