示例#1
0
 def create_app(self):
     """
     Create the wsgi application
     """
     app_ = feedback.create_app(
         FEEDBACK_SLACK_END_POINT=
         'https://hooks.slack.com/services/TOKEN/TOKEN',
         FEEDBACK_SLACK_EMOJI=':interrobang:',
         FORM_SLACK_EMOJI=':inbox_tray:',
         DEFAULT_EMAIL='*****@*****.**',
         FEEDBACK_FORMS_ORIGIN='user_submission',
         BBB_FEEDBACK_ORIGIN='bbb_feedback',
         FEEDBACK_TEMPLATES={
             'Missing References': 'missing_references.txt',
             'Associated Articles': 'associated_articles.txt',
             'Updated Record': 'updated_record.txt',
             'New Record': 'new_record.txt',
             'Bumblebee Feedback': 'bumblebee_feedback.txt'
         },
         FEEDBACK_EMAILS={
             'Missing References': '*****@*****.**',
         },
         MAIL_SUPPRESS_SEND=True,
         GOOGLE_RECAPTCHA_ENDPOINT=
         'https://www.google.com/recaptcha/api/siteverify',
         GOOGLE_RECAPTCHA_PRIVATE_KEY='MY_PRIVATE_KEY')
     return app_
示例#2
0
from adsws import benchmark

def get_resources(*apps):
    r = {}
    for _container in apps:
        app = _container['app']
        mnt = _container['mount']
        r[app.name] = {}
        r[app.name]['endpoints'] = []
        r[app.name]['base'] = mnt
        for rule in app.url_map.iter_rules():
            r[app.name]['endpoints'].append(rule.rule)
    return r

API = dict(mount='/v1', app=api.create_app())
ACCOUNTS = dict(mount='/v1/accounts', app=accounts.create_app())
FEEDBACK = dict(mount='/v1/feedback', app=feedback.create_app())
BENCHMARK = dict(mount='/benchmark', app=benchmark.create_app())

resources = get_resources(API, ACCOUNTS, FEEDBACK)

application = DispatcherMiddleware(frontend.create_app(resources=resources), {
    API['mount']: API['app'],
    ACCOUNTS['mount']: ACCOUNTS['app'],
    FEEDBACK['mount']: FEEDBACK['app'],
    BENCHMARK['mount']: BENCHMARK['app'],
})

if __name__ == "__main__":
    run_simple('0.0.0.0', 5000, application, use_reloader=False, use_debugger=True)
示例#3
0
 def create_app(self):
     """
     Create the wsgi application
     """
     app_ = feedback.create_app()
     return app_
示例#4
0
 def create_app(self):
     """
     Create the wsgi application
     """
     app_ = feedback.create_app()
     return app_