def app(event_loop): app = Sanic() add_routes(app) return app
async def app(loop): app = application.create_app() add_routes(app) yield app
from aiohttp import web import os from app.settings import config from app.routes import add_routes app = web.Application() app["config"] = config add_routes(app) port = int(os.environ.get("PORT", 8080)) web.run_app(app, port=port)
"""Main controller script for the Engage website""" import os import sys # Third party libraries path must be fixed before importing webapp2 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'app/external')) import webapp2 # URL mapping for appliation in /app/routes.py from app import routes debug = os.environ['SERVER_SOFTWARE'].startswith('Dev') # initialize the application app = webapp2.WSGIApplication(debug=debug) # add routes to the application routes.add_routes(app)
async def main(): app_server = web.Application() add_routes(app_server) return app_server
#!/usr/bin/env python3 from app.application import create_app from aiohttp import web from app.routes import add_routes application = create_app() add_routes(application.router) web.run_app(application, port=8000)
import os import webapp2 from app import routes webapp2_config = {'webapp2_extras.sessions': {'secret_key': 'hfgskahjfgd736987qygukr3279rtigu', 'webapp2_extras.jinja2': {'template_path': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'templates')}}} application = webapp2.WSGIApplication(debug=True, config=webapp2_config) routes.add_routes(application)
print('## Baixando pacotes extras...') nltk.download('punkt') nltk.download('stopwords') nltk.download('rslp') print('## Pronto...\n') except: print('## Erro ao baixar os pacotes!\n') exit(0) print('## Aplicando configurações e instanciando ferramentas...') # Caminho da base de dados base_dir = '/app/base_de_dados/' # Tratamentos a serem aplicados no corpus tratement = ['alpha_num', 'lower_case', 'stop_words', 'steamming'] print('## Instanciando a engine...') search_engine = Search_engine(base_dir, tratement) print( '## Iniciando processamento da base de dados. Isso pode demorar um pouco...' ) search_engine.proccess_database() print('## Subindo api...') app = app add_routes(app, search_engine) config = configparser.ConfigParser() config.read('config/configuration.cfg') app.run(host=config.get('general', 'host', fallback='0.0.0.0'), port=config.get('general', 'port', fallback='8000'), debug=False)