Beispiel #1
0
# Redirect print statements
# http://serverfault.com/questions/239614/wsgi-and-python-print-statements#239621
sys.stdout = sys.stderr

# Fix path
path = os.path.dirname(__file__)
if path not in sys.path:
    sys.path.append(path)
os.chdir(path)

# import all library code and application packages
sys.path.append(path + '/vendor')
sys.path.append(path + '/mopa')
from mopa import create_app


def wsgi_app(environ, start_response):
    import sys
    output = sys.version.encode('utf8')
    status = '200 OK'
    headers = [('Content-type', 'text/plain'),
               ('Content-Length', str(len(output)))]
    start_response(status, headers)
    yield output


# mod_wsgi need the *application* variable to serve our small app
# application = wsgi_app
application = create_app()
Beispiel #2
0
    from gevent import monkey
    monkey.patch_all()

# Redirect print statements to stderr
# http://serverfault.com/questions/239614/wsgi-and-python-print-statements#239621
sys.stdout = sys.stderr

# Fix path
path = os.path.dirname(__file__)
if path not in sys.path:
    sys.path.append(path)
os.chdir(path)

# import all library code and application packages
sys.path.append(path + '/mopa')
from mopa import create_app


def wsgi_app(environ, start_response):
    import sys
    output = sys.version.encode('utf8')
    status = '200 OK'
    headers = [('Content-type', 'text/plain'),
               ('Content-Length', str(len(output)))]
    start_response(status, headers)
    yield output


# mod_wsgi needs a `application` variable in order to serve our app
application = create_app()
Beispiel #3
0
 def setUp(self):
     self.app = app = create_app()
     app.testing = True
     self.client = app.test_client()
Beispiel #4
0
 def setUp(self):
     self.app = app = create_app()
     app.testing = True
     self.client = app.test_client()
Beispiel #5
0
# -*- coding: utf-8 -*-

import os
import subprocess
import sys

sys.path.insert(1, os.path.join(os.path.abspath('.'), 'vendor'))

from mopa import create_app
from flask import Flask, g, jsonify, url_for
from flask_script import Manager, Shell

app = create_app()
manager = Manager(app)


def make_shell_context():
    return dict(app=app)
manager.add_command("shell", Shell(make_context=make_shell_context))


@manager.command
def test(coverage=False):
    """Runs unit tests and presents coverage report"""
    tests = subprocess.call(['python', '-c', "import os; import sys; sys.path.insert(1, os.path.join(os.path.abspath('.'), 'vendor')); import tests as tests; tests.run()"])
    sys.exit(tests)


@manager.command
def list_routes():
    """Lists all public and static routes"""
Beispiel #6
0
# -*- coding: utf-8 -*-

import os
import subprocess
import sys

from mopa import create_app
from flask import Flask, g, jsonify, url_for
from flask_script import Manager, Shell

app = create_app()
manager = Manager(app)


def make_shell_context():
    return dict(app=app)


manager.add_command("shell", Shell(make_context=make_shell_context))


@manager.command
def test(coverage=False):
    """Runs unit tests and presents coverage report"""
    tests = subprocess.call(
        ['python', '-c', "import tests as tests; tests.run()"])
    sys.exit(tests)


@manager.command
def list_routes():