mastodon-BDSM/BDSM/__init__.py

23 lines
576 B
Python
Raw Normal View History

2022-09-18 05:23:33 +02:00
#!/usr/bin/env python3
import os
import sys
from flask import Flask, flash
from flask_sqlalchemy import SQLAlchemy
# SQLite URI compatible
WIN = sys.platform.startswith('win')
if WIN:
prefix = 'sqlite:///'
else:
prefix = 'sqlite:////'
app = Flask(__name__)
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'dev')
app.config['SQLALCHEMY_DATABASE_URI'] = prefix + os.path.join(os.path.dirname(app.root_path), os.getenv('DATABASE_FILE', 'data.db'))
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
from BDSM import views, models, commands