staticfiles served
This commit is contained in:
parent
ac5f298c7d
commit
1965c19bc4
3 changed files with 17 additions and 6 deletions
10
requirements.txt
Normal file
10
requirements.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
SQLAlchemy==0.8.3
|
||||
aiofiles==0.6.0
|
||||
click==7.1.2
|
||||
fastapi==0.62.0
|
||||
h11==0.11.0
|
||||
pydantic==1.7.3
|
||||
starlette==0.13.6
|
||||
techrec @ file:///home/gordo/my/ror/techrec
|
||||
typing-extensions==3.7.4.3
|
||||
uvicorn==0.13.1
|
2
setup.py
2
setup.py
|
@ -13,7 +13,7 @@ setup(
|
|||
author_email="piuttosto@logorroici.org",
|
||||
packages=["techrec"],
|
||||
package_dir={"techrec": "techrec"},
|
||||
install_requires=["SQLAlchemy==0.8.3", "fastapi==0.62.0"],
|
||||
install_requires=["SQLAlchemy==0.8.3", "fastapi==0.62.0", "aiofiles==0.6.0"],
|
||||
classifiers=["Programming Language :: Python :: 3.7"],
|
||||
entry_points={"console_scripts": ["techrec = techrec.cli:main"]},
|
||||
zip_safe=False,
|
||||
|
|
|
@ -4,10 +4,10 @@ import logging
|
|||
import os
|
||||
import unicodedata
|
||||
from datetime import datetime
|
||||
from functools import partial
|
||||
|
||||
from fastapi import FastAPI, HTTPException, Response
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from .cli import common_pre
|
||||
from .config_manager import get_config
|
||||
|
@ -258,7 +258,7 @@ def get_archive():
|
|||
|
||||
@app.get("/api/help")
|
||||
@app.get("/api")
|
||||
def help():
|
||||
def api_help():
|
||||
return Response(
|
||||
media_type="text/html",
|
||||
content="""
|
||||
|
@ -290,9 +290,10 @@ def rec_err(msg, **kwargs):
|
|||
return self.rec_msg(msg, status=False, **kwargs)
|
||||
|
||||
|
||||
# TODO: serve /output/<filepath:path> reading from get_config()['AUDIO_OUTPUT']
|
||||
# TODO: serve /static/<filepath:path> reading from get_config()['STATIC_FILES']
|
||||
# TODO: self._app.route("/", callback=lambda: redirect("/new.html"))
|
||||
app.mount("/output", StaticFiles(directory=get_config()["AUDIO_OUTPUT"]))
|
||||
app.mount("/static", StaticFiles(directory=get_config()["STATIC_FILES"]))
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def home():
|
||||
return RedirectResponse("/new.html")
|
||||
|
|
Loading…
Reference in a new issue