Merge branch 'main' of ssh://git.edgarpierre.fr:39529/edpibu/nummi
This commit is contained in:
commit
98fea25615
2 changed files with 7 additions and 4 deletions
|
@ -22,11 +22,9 @@ from django.conf.urls.static import static
|
|||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("media/<path:path>", views.media, name="media"),
|
||||
] + i18n_patterns(
|
||||
urlpatterns = [path("media/<path:path>", views.media, name="media"),] + i18n_patterns(
|
||||
path("", include("main.urls")),
|
||||
path("plot/", include("plot.urls")),
|
||||
path("admin/", admin.site.urls),
|
||||
prefix_default_language=False,
|
||||
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
)
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.static import serve
|
||||
|
||||
|
||||
@login_required
|
||||
def media(request, path):
|
||||
if settings.DEBUG:
|
||||
return serve(request, path, settings.MEDIA_ROOT)
|
||||
_res = HttpResponse()
|
||||
_res["Content-Type"] = ""
|
||||
_res["X-Accel-Redirect"] = "/internal/media/" + path
|
||||
|
|
Loading…
Reference in a new issue