Fix Error `404 Not Found` for Static Files (#124)

After changing for FastAPI the server ignores STATIC_ROOT and STATIC_URL
master
Victor R. Santos 3 years ago committed by GitHub
parent ee8349d419
commit ce70045dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,6 +4,7 @@ from django.conf import settings
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.trustedhost import TrustedHostMiddleware
from fastapi.staticfiles import StaticFiles
from django_etebase import app_settings
@ -74,4 +75,6 @@ def create_application(prefix="", middlewares=[]):
async def custom_exception_handler(request: Request, exc: CustomHttpException):
return MsgpackResponse(status_code=exc.status_code, content=exc.as_dict)
app.mount(settings.STATIC_URL, StaticFiles(directory=settings.STATIC_ROOT), name="static")
return app

Loading…
Cancel
Save