Serve uploaded files through get_uploaded_file in development.

Previously, uploaded files were served:
* With S3UploadBackend, via get_uploaded_file (redirects to S3)
* With LocalUploadBackend in production, via nginx directly
* With LocalUploadBackend in development, via Django's static file server

This changes that last case to use get_uploaded_file in development,
which is a key step towards being able to do proper access control
authorization.

Does not affect production.
This commit is contained in:
rahuldeve
2016-06-09 15:49:56 +05:30
committed by Tim Abbott
parent 719e5487b9
commit fa13582ffb
3 changed files with 26 additions and 7 deletions

View File

@@ -98,8 +98,6 @@ if settings.DEVELOPMENT and settings.LOCAL_UPLOADS_DIR is not None:
urlpatterns += patterns('',
url(r'^user_avatars/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': os.path.join(settings.LOCAL_UPLOADS_DIR, "avatars")}),
url(r'^user_uploads/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': os.path.join(settings.LOCAL_UPLOADS_DIR, "files")}),
)
urlpatterns += patterns('zerver.views',