示例#1
0
文件: manage.py 项目: mpaolino/shorty
def mktestbed():
    from shorty import app
    db_fd, tmp_file = tempfile.mkstemp()
    full_db_uri = 'sqlite:///%s' % tmp_file
    app.config['DATABASE'] = tmp_file
    app.config['DB_FD'] = db_fd
    app.config['DATABASE_URI'] = full_db_uri
    app.config['SQLALCHEMY_DATABASE_URI'] = full_db_uri
    app.config['TESTING'] = True
    from shorty.database import init_db
    init_db()
示例#2
0
文件: deploy.py 项目: mpaolino/shorty
# -*- coding: utf-8 -*-
from shorty import app
# load the middleware from werkzeug
# This middleware can be applied to add HTTP proxy support to an application
# that was not designed with HTTP proxies in mind.
# It sets `REMOTE_ADDR`, `HTTP_POST` from `X-Forwarded` headers.
from werkzeug.contrib.fixers import ProxyFix

try:
    from shorty import settings
except ImportError:
    import logging
    import sys
    logging.error('Could not find settings. Aborting...')
    sys.exit(1)

app.config.from_object(settings)

from shorty.routes import *
from shorty.database import init_db
init_db()

app.wsgi_app = ProxyFix(app.wsgi_app)
示例#3
0
 def setUp(self):
     init_db()