|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
from django.core.wsgi import get_wsgi_application
|
|
|
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
|
|
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "etebase_server.settings")
|
|
|
|
|
application = get_wsgi_application()
|
|
|
|
@ -10,6 +9,8 @@ from django.conf import settings
|
|
|
|
|
|
|
|
|
|
# Not at the top of the file because we first need to setup django
|
|
|
|
|
from fastapi import FastAPI, Request
|
|
|
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
|
from fastapi.middleware.trustedhost import TrustedHostMiddleware
|
|
|
|
|
|
|
|
|
|
from .exceptions import CustomHttpException
|
|
|
|
|
from .authentication import authentication_router
|
|
|
|
@ -35,6 +36,7 @@ if settings.DEBUG:
|
|
|
|
|
app.add_middleware(
|
|
|
|
|
CORSMiddleware, allow_origin_regex="https?://.*", allow_credentials=True, allow_methods=["*"], allow_headers=["*"]
|
|
|
|
|
)
|
|
|
|
|
app.add_middleware(TrustedHostMiddleware, allowed_hosts=settings.ALLOWED_HOSTS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.exception_handler(CustomHttpException)
|
|
|
|
|