xppl/app/__init__.py

27 lines
985 B
Python
Raw Normal View History

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
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
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-05-23 14:12:24 +02:00
UPLOAD_FOLDER_COVER = os.path.join(basedir, 'uploads/cover')
2018-06-01 20:26:37 +02:00
#ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
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-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)
app.config.from_object(__name__)
from app import views