22 lines
576 B
Python
22 lines
576 B
Python
#!/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
|