|
|
|
import os
|
|
|
|
from os import environ
|
|
|
|
|
|
|
|
from dotenv import find_dotenv, load_dotenv
|
|
|
|
from flask import Flask
|
|
|
|
from flask_socketio import SocketIO
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from sqlalchemy.dialects import registry
|
|
|
|
|
|
|
|
registry.register("rqlite.pyrqlite", "sqlalchemy_rqlite.pyrqlite", "dialect")
|
|
|
|
|
|
|
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
UPLOAD_FOLDER = os.path.join(basedir, 'uploads')
|
|
|
|
UPLOAD_FOLDER_COVER = os.path.join(basedir, 'cover')
|
|
|
|
|
|
|
|
load_dotenv(find_dotenv())
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
app.config['SECRET_KEY'] = 'super secret key'
|
|
|
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
|
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'rqlite+pyrqlite://localhost:4001/'
|
|
|
|
app.config['DEBUG'] = True
|
|
|
|
app.config['PORT'] = 80
|
|
|
|
|
|
|
|
db = SQLAlchemy(app)
|
|
|
|
light = not os.path.isdir(UPLOAD_FOLDER)
|
|
|
|
DOMAIN = environ.get('DOMAIN')
|
|
|
|
socketio = SocketIO(app)
|
|
|
|
|
|
|
|
app.config.from_object(__name__)
|
|
|
|
|
|
|
|
from app import views # noqa
|