Use NGINX X-Accel-Redirect to protect media
This commit is contained in:
parent
29e9dba141
commit
eb03db2dff
3 changed files with 22 additions and 4 deletions
|
|
@ -14,11 +14,11 @@ Including another URLconf
|
|||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from django.urls import include, path, re_path
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
|
||||
from .views import IndexView
|
||||
from .views import IndexView, MediaAccess
|
||||
|
||||
# photologue_custom overrides some photologue patterns
|
||||
urlpatterns = [
|
||||
|
|
@ -33,3 +33,5 @@ urlpatterns = [
|
|||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
else:
|
||||
urlpatterns.append(re_path('^media/(?P<path>.*)', MediaAccess.as_view(), name='media'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue