예제 #1
0
파일: wsgi.py 프로젝트: ntxuva/mopa-utils
# 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()
예제 #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()
예제 #3
0
 def setUp(self):
     self.app = app = create_app()
     app.testing = True
     self.client = app.test_client()
예제 #4
0
 def setUp(self):
     self.app = app = create_app()
     app.testing = True
     self.client = app.test_client()
예제 #5
0
파일: manage.py 프로젝트: ntxuva/mopa-utils
# -*- 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"""
예제 #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():