Last active
February 9, 2018 06:03
-
-
Save Nipun2016/d82a0a4f82d2f2e9177c05ab8186d37c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You will need to set MEDIA_URL and MEDIA_ROOT in your project’s settings.py. | |
MEDIA_URL = '/media/' | |
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') | |
In the development server you may serve the user uploaded files (media) using django.contrib.staticfiles.views.serve() view. | |
from django.conf import settings | |
from django.conf.urls.static import static | |
urlpatterns = [ | |
# Project url patterns... | |
] | |
if settings.DEBUG: | |
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment