2018-05-20 00:10:01 +02:00
|
|
|
from flask import Flask
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from marshmallow import Schema, fields, ValidationError, pre_load
|
2018-06-03 12:29:08 +02:00
|
|
|
from flask_socketio import SocketIO, emit
|
|
|
|
from os import environ
|
|
|
|
from dotenv import load_dotenv, find_dotenv
|
2018-05-20 00:10:01 +02:00
|
|
|
import os
|
2018-05-23 15:58:16 +02:00
|
|
|
import click
|
2018-05-20 00:10:01 +02:00
|
|
|
from werkzeug.utils import secure_filename
|
2018-05-31 17:30:16 +02:00
|
|
|
from sqlalchemy.dialects import registry
|
2018-06-07 10:46:14 +02:00
|
|
|
# import flask_whooshalchemyplus not using whoosh anymore
|
2018-06-03 15:23:10 +02:00
|
|
|
|
2018-05-31 17:30:16 +02:00
|
|
|
registry.register("rqlite.pyrqlite", "sqlalchemy_rqlite.pyrqlite", "dialect")
|
2018-05-20 00:10:01 +02:00
|
|
|
|
|
|
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
UPLOAD_FOLDER = os.path.join(basedir, 'uploads')
|
2018-06-12 13:17:02 +02:00
|
|
|
UPLOAD_FOLDER_COVER = os.path.join(basedir, 'cover')
|
2018-06-01 20:26:37 +02:00
|
|
|
#ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
|
2018-06-03 12:29:08 +02:00
|
|
|
load_dotenv(find_dotenv())
|
2018-05-20 00:10:01 +02:00
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
app.config['SECRET_KEY'] = 'super secret key'
|
|
|
|
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/mydatabase.db'
|
|
|
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
2018-05-29 16:18:00 +02:00
|
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'rqlite+pyrqlite://localhost:4001/'
|
2018-06-03 12:29:08 +02:00
|
|
|
app.config['DEBUG'] = True
|
|
|
|
app.config['PORT'] = 80
|
|
|
|
|
2018-05-31 17:30:16 +02:00
|
|
|
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'mydatabase.db')
|
2018-05-20 00:10:01 +02:00
|
|
|
db = SQLAlchemy(app)
|
2018-06-12 13:17:02 +02:00
|
|
|
light = not os.path.isdir(UPLOAD_FOLDER)
|
2018-06-03 12:29:08 +02:00
|
|
|
DOMAIN = environ.get('DOMAIN')
|
|
|
|
socketio = SocketIO(app)
|
|
|
|
|
2018-05-20 00:10:01 +02:00
|
|
|
app.config.from_object(__name__)
|
|
|
|
from app import views
|
2018-06-03 15:23:10 +02:00
|
|
|
|