示例#1
0
from jivago.jivago_application import JivagoApplication

import hello_world.app

application = JivagoApplication(hello_world.app, debug=False)

if __name__ == '__main__':
    application.run_dev()
示例#2
0
from pdfinvert.wsgi.filter.temporary_file_cleanup_filter import TemporaryFileCleanupFilter


class InvertPdfContext(ProductionJivagoContext):
    LOGGER = logging.getLogger("InvertPdfContext")

    def create_router_config(self) -> RouterBuilder:
        config = super().create_router_config() \
            .add_rule(FilteringRule("*", [TemporaryFileCleanupFilter])) \
            .add_rule(RoutingRule("/static/",
                                  StaticFileRoutingTable(os.path.dirname(static.__file__),
                                                         allowed_extensions=[".png", ".ico", ".html", ".css"])))

        prometheus_endpoint = os.environ.get("PROMETHEUS_GATEWAY_ENDPOINT")
        if prometheus_endpoint:
            InvertPdfContext.LOGGER.info(
                f"Using prometheus pushgateway endpoint {prometheus_endpoint}")
            config.add_rule(FilteringRule("*", [RequestMetricsFilter]))

        return config


logging.getLogger().setLevel(logging.INFO)

application = JivagoApplication(pdfinvert.wsgi, context=InvertPdfContext)

if __name__ == '__main__':
    port = int(os.getenv("PORT", 8080))

    application.run_dev(port=port, host="0.0.0.0")
示例#3
0
import my_hello_world_application
from jivago.jivago_application import JivagoApplication

app = JivagoApplication(my_hello_world_application)

if __name__ == '__main__':
    app.run_dev()
示例#4
0
from jivago.lang.annotations import Override

import vision_project
from vision_project.vision.coordinate_converter import CalibratedCoordinateTranslator
from vision_project.vision.coordinate_translator import CoordinateTranslator
from vision_project.vision.image_repository import ImageRepository, SimpleImageRepository


class CameraCaptureContext(DebugJivagoContext):
    @Override
    def configure_service_locator(self):
        super().configure_service_locator()
        repository = SimpleImageRepository()
        self.serviceLocator.bind(ImageRepository, repository)
        self.serviceLocator.bind(CoordinateTranslator,
                                 CalibratedCoordinateTranslator())

    @Override
    def get_config_file_locations(self) -> List[str]:
        return [
            os.path.join(str(Path.home()), "vision.yml"),
            os.path.join(os.path.dirname(vision_project.__file__),
                         "vision.yml"), "vision.yml"
        ]


app = JivagoApplication(vision_project, context=CameraCaptureContext)

if __name__ == "__main__":
    app.run_dev(host="0.0.0.0")
示例#5
0
from jivago.jivago_application import JivagoApplication

app = JivagoApplication()

if __name__ == '__main__':
    # using the bundled werkzeug server
    app.run_dev(port=4000, host="localhost")

    # or alternatively
    from werkzeug.serving import run_simple

    run_simple('localhost', 4000, app)
示例#6
0
文件: main.py 项目: keotl/prismarine
import logging

from jivago.jivago_application import JivagoApplication
from jivago.lang.registry import Registry

import prismarine
from prismarine.infrastructure.config.prismarine_context import PrismarineContext

logging.getLogger().setLevel(logging.INFO)
app = JivagoApplication(prismarine,
                        context=PrismarineContext(prismarine, Registry()))

if __name__ == '__main__':
    app.run_dev(host='0.0.0.0', port=4000)