-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serving media files #32
Comments
I'm afraid not. WhiteNoise is optimized to serve a small set of files that remain fixed while the application is running, and it wouldn't work well for this purpose. I think most people using WhiteNoise use Amazon S3 to store and serve their media files. If you just want to serve media files in development then I've used a pattern like this in my if settings.SERVE_MEDIA_FILES:
urlpatterns += patterns('',
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL.lstrip('/'),
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),) And then in development I have |
Actually WhiteNoise can be used to serve media files. Probably it's not optimal but still if you use some sort of CDN you can put in your wsgi.py file the following code:
Prefix is hardcoded because if you use CDN you can can configure your |
@vstoykov I'm afraid this won't work how you expect it to. WhiteNoise scans for available files on startup and assumes that they won't change for the lifetime of the process. So any new files that get uploaded while the app is running won't get served. |
This doesn't work b/c whitenoise causes available files on startup. See evansd/whitenoise#32 (comment) This reverts commit 0008294.
This doesn't work b/c whitenoise causes available files on startup. See evansd/whitenoise#32 (comment) This reverts commit 0008294.
This doesn't work b/c whitenoise causes available files on startup. See evansd/whitenoise#32 (comment) This reverts commit 0008294.
Is there any option in DjangoWhiteNoise to serve media files like MediaCling of dj-static?
The text was updated successfully, but these errors were encountered: