示例#1
0
from argos.web import api, front

app = api.create_app()

# Run!
if __name__ == '__main__':
    app.run(host='0.0.0.0')
示例#2
0
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand

from manage import core, web
from argos.web import api

from flask import request

if __name__ == '__main__':
    # Get the command to determine the app config.
    if 'evaluate' in sys.argv[1]:
        config = {
                'SQLALCHEMY_DATABASE_URI': 'postgresql://*****:*****@localhost:5432/argos_eval'
        }
        app = api.create_app(**config)
    else:
        app = api.create_app()

    # For debugging...
    @app.before_request
    def log_request():
        print(request.url)
        print(request.headers)

    manager = Manager(app)

    # Web
    manager.add_command('create:client', web.CreateClientCommand())
    manager.add_command('create:admin', web.CreateAdminCommand())
示例#3
0
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand

from manage import core, web
from argos.web import api

from flask import request

if __name__ == '__main__':
    # Get the command to determine the app config.
    if 'evaluate' in sys.argv[1]:
        config = {
            'SQLALCHEMY_DATABASE_URI':
            'postgresql://*****:*****@localhost:5432/argos_eval'
        }
        app = api.create_app(**config)
    else:
        app = api.create_app()

    # For debugging...
    @app.before_request
    def log_request():
        print(request.url)
        print(request.headers)

    manager = Manager(app)

    # Web
    manager.add_command('create:client', web.CreateClientCommand())
    manager.add_command('create:admin', web.CreateAdminCommand())
示例#4
0
from argos.web import api, front
from argos.datastore import db
from argos.tasks import workers

from tests.patches import patch_knowledge, patch_concepts, patch_aws
from tests import helpers

import numpy as np
np.seterr(invalid='ignore')

test_config = {
        'SQLALCHEMY_DATABASE_URI': 'postgresql://*****:*****@localhost:5432/argos_test'
}

bare_app = web.create_app(**test_config)
api_app = api.create_app(**test_config)
front_app = front.create_app(**test_config)

for app in [api_app, front_app]:
    app.register_blueprint(helpers.blueprint)


class RequiresMocks(unittest.TestCase):
    def create_patch(self, name, **kwargs):
        """
        Helper for patching/mocking methods.

        Args:
            | name (str)       -- the 'module.package.method' to mock.
        """
        patcher = patch(name, autospec=True, **kwargs)