Beispiel #1
0
# -*- coding: utf-8 -*-
'''
Created on 01 de dez de 2017

@author: Rodrigo Nogueira
'''
from services import OCRUtils, AppConfig
from services.StartOCR import main, ABOCRServicesAPP as application

main()
application.config.from_object(AppConfig.DevConfig)
OCRUtils.setup_logging("Gunicorn")
Beispiel #2
0

@ABOCRServicesAPP.route("/")
def welcome():
    OCRUtils.getLogger(__name__).debug('Welcome Sir!')
    return "Serviços de OCR de imagens."


def main():
    OCRUtils.application = ABOCRServicesAPP
    ABOCRServicesAPP.config.from_object(DevConfig)

    #api resource routing
    _api.add_resource(ABOCRServices, '/ocr/imagens',
                      '/ocr/leituras/<codigoLeituraOCR>')


#Se este arquivo é executado, roda o servidor do Flask. Para rodar no Gunicorn, basta
#iniciar o arquivo correspondente com o ABServicesAPP.run executando no contexto do Gunicorn.
if __name__ == "__main__":
    main()
    OCRUtils.setup_logging("Flask")
    # Host e porta do servidor
    SERVER_HOST = '0.0.0.0'
    SERVER_PORT = ABOCRServicesAPP.config.get("SERVER_PORT")
    DEBUG = ABOCRServicesAPP.config.get("APP_LOG_LEVEL") == logging.DEBUG
    ABOCRServicesAPP.run(debug=DEBUG,
                         threaded=True,
                         host=SERVER_HOST,
                         port=SERVER_PORT)