Compare commits
3 commits
cd3daf7525
...
e74fd6b9ba
Author | SHA1 | Date | |
---|---|---|---|
e74fd6b9ba | |||
5c6862180b | |||
7f9e19a74f |
2 changed files with 14 additions and 10 deletions
|
@ -55,14 +55,16 @@ def main(ctx, database, log_level):
|
|||
@click.option("--scheme", envvar="TUTOR_SCHEME")
|
||||
@click.option("--static", envvar="TUTOR_STATIC", type=click.Path(file_okay=False))
|
||||
@click.option("--debug", is_flag=True)
|
||||
@click.option("--reload", is_flag=True)
|
||||
@click.pass_context
|
||||
def server(ctx, port, scheme, static, debug):
|
||||
def server(ctx, port, scheme, static, debug, reload):
|
||||
app = tutor.server.Application(
|
||||
**{
|
||||
**ctx.obj,
|
||||
"scheme": scheme,
|
||||
"static": static,
|
||||
"debug": debug,
|
||||
"autoreload": reload,
|
||||
}
|
||||
)
|
||||
app.listen(port)
|
||||
|
@ -70,8 +72,7 @@ def server(ctx, port, scheme, static, debug):
|
|||
|
||||
|
||||
@main.group("import")
|
||||
def import_group():
|
||||
...
|
||||
def import_group(): ...
|
||||
|
||||
|
||||
@import_group.command("cards")
|
||||
|
|
|
@ -218,9 +218,9 @@ class SearchHandler(RequestHandler):
|
|||
limit=limit + 1,
|
||||
offset=limit * (page - 1),
|
||||
sort_by=sort_by,
|
||||
in_collection=in_collection in ("yes", "true")
|
||||
if in_collection
|
||||
else None,
|
||||
in_collection=(
|
||||
in_collection in ("yes", "true") if in_collection else None
|
||||
),
|
||||
)
|
||||
has_more = copies and len(copies) > limit
|
||||
self.set_header("Content-Type", "application/json")
|
||||
|
@ -419,10 +419,13 @@ class StaticFileHandler(tornado.web.StaticFileHandler):
|
|||
class Application(tornado.web.Application):
|
||||
def __init__(self, **settings):
|
||||
version = importlib.metadata.version(__package__)
|
||||
settings.setdefault(
|
||||
"template_path",
|
||||
importlib.resources.files(__package__) / "templates",
|
||||
)
|
||||
template_path = importlib.resources.files(__package__) / "templates"
|
||||
settings["template_path"] = str(template_path)
|
||||
|
||||
if settings.get("autoreload"):
|
||||
import tornado.autoreload
|
||||
|
||||
tornado.autoreload.watch(str(template_path / "openapi.yaml"))
|
||||
|
||||
paths = [
|
||||
(
|
||||
|
|
Loading…
Reference in a new issue