1
0
mirror of https://github.com/etesync/server synced 2024-11-22 16:58:08 +00:00

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

After changing for FastAPI the server ignores STATIC_ROOT and STATIC_URL
This commit is contained in:
Victor R. Santos 2022-03-20 12:21:09 +00:00 committed by GitHub
parent ee8349d419
commit ce70045dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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