Example #1
0
File: app.py Project: xcoo/davdav
from flask import Flask, Response
from flask import render_template, redirect, request, abort
from werkzeug import SharedDataMiddleware
from sqlalchemy import create_engine

from thumbnail import ThumbnailDao

app = Flask(__name__)

try:
    app.config.from_envvar("DAVDAV_CONFIG")
except RuntimeError:
    app.debug = True
    app.testing = True
    app.config["DB_URI"] = "mysql://root:root@localhost/davdav?charset=utf8"
    app.config["WEBDAV_ROOT_URL"] = "http://localhost:5000/test/main"
    app.config["THUMB_ROOT_URL"] = "http://localhost:5000/test/thumbnail"
    app.config["WEBDAV_DIR"] = os.path.join(os.path.dirname(__file__), "static/test/main")
    app.config["THUMB_DIR"] = os.path.join(os.path.dirname(__file__), "static/test/thumbnail")
    app.config["NUM_BY_PAGE"] = 2
    app.config["FOOTER_ENABLE"] = True
    app.config["AUTH_ENABLE"] = True
    app.config["AUTH_USERNAME"] = "username"
    app.config["AUTH_PASSWORD"] = "password"

app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {"/": os.path.join(os.path.dirname(__file__), "static")})

engine = create_engine(app.config["DB_URI"], encoding="utf-8", convert_unicode=True, pool_recycle=3600)

thumbnail_dao = ThumbnailDao(engine)
Example #2
0
"""ShadowShare Server Backend
"""
from flask import Flask
import sqlalchemy


def init_engine(app):
    app.engine = sqlalchemy.create_engine(app.config["DB_URI"])


app = Flask(__name__)
app.config["UPLOAD_FOLDER"] = "uploads"
app.config["DB_URI"] = "sqlite:///server/shadowshare.db"
app.debug = True

import server.views
import server.io