예제 #1
0
파일: test_music.py 프로젝트: Julian/Great
    def setUp(self):
        super(ApplicationTestMixin, self).setUp()
        self.config = {"db" : {"url" : "sqlite://"}}
        self.great = create_app(config=self.config)
        self.app = TestApp(wsgi.create_app(self.great))

        METADATA.create_all(self.great.bin.provide("db"))
예제 #2
0
파일: test_music.py 프로젝트: Julian/Great
    def setUp(self):
        super(ApplicationTestMixin, self).setUp()
        self.config = {"db": {"url": "sqlite://"}}
        self.great = create_app(config=self.config)
        self.app = TestApp(wsgi.create_app(self.great))

        METADATA.create_all(self.great.bin.provide("engine").connect())
예제 #3
0
파일: great.py 프로젝트: Julian/Great
    def makeService(self, options):
        greatPath = FilePath(great.__file__).parent()
        staticPath = greatPath.child("static")
        templatesPath = greatPath.child("templates")

        rootResource = Resource()
        rootResource.putChild("", File(staticPath.child("index.html").path))
        rootResource.putChild("static", File(staticPath.path))
        rootResource.putChild("templates", File(templatesPath.path))

        rootResource.putChild("great", MinionResource(create_app()))

        greatService = StreamServerEndpointService(
            endpoint=options["endpoint"],
            factory=server.Site(rootResource),
        )

        redirects = options["redirects"]
        if not redirects:
            return greatService

        service = MultiService()
        greatService.setServiceParent(service)

        for redirect in redirects:
            redirectService = StreamServerEndpointService(
                endpoint=redirect,
                factory=server.Site(Redirect(options["canonical_url"])),
            )
            redirectService.setServiceParent(service)

        return service
예제 #4
0
파일: tap.py 프로젝트: Julian/Great
def makeService(options):
    if options["migrate"]:
        root = Path.from_string(__file__).sibling("alembic")
        alembic_config = alembic.config.Config(
            str(root.descendant("config.ini")),
        )
        alembic.command.upgrade(alembic_config, "head")

    greatPath = Path.from_string(great.__file__).parent()
    staticPath = greatPath.descendant("static")
    templatesPath = greatPath.descendant("templates")

    rootResource = twisted.web.resource.Resource()
    rootResource.putChild("", File(str(staticPath.descendant("index.html"))))
    rootResource.putChild("static", File(str(staticPath)))
    rootResource.putChild("api", MinionResource(create_app()))

    site = server.Site(rootResource)
    return strports.service(description=options["port"], factory=site)