mirror of
https://github.com/Findus23/RadioStats.git
synced 2024-09-09 04:23:47 +02:00
32 lines
765 B
Python
32 lines
765 B
Python
# Blog configuration values.
|
|
|
|
import sentry_sdk
|
|
from flask import Flask
|
|
from flask_caching import Cache
|
|
from playhouse.flask_utils import FlaskDB
|
|
from playhouse.pool import PooledMySQLDatabase, PooledPostgresqlDatabase
|
|
from sentry_sdk.integrations.flask import FlaskIntegration
|
|
|
|
import config
|
|
|
|
DATABASE = PooledPostgresqlDatabase(**config.db)
|
|
if config.cache:
|
|
CACHE_TYPE = "redis"
|
|
else:
|
|
CACHE_TYPE = "null"
|
|
CACHE_REDIS_DB = config.redisDB
|
|
|
|
if config.sentryDSN:
|
|
sentry_sdk.init(
|
|
dsn=config.sentryDSN,
|
|
integrations=[FlaskIntegration()]
|
|
)
|
|
|
|
# Create a Flask WSGI app and configure it using values from the module.
|
|
app = Flask(__name__)
|
|
app.config.from_object(__name__)
|
|
cache = Cache(app)
|
|
|
|
flask_db = FlaskDB(app)
|
|
|
|
db = flask_db.database
|