From aea3ce67a0800285b20b93018b7c0a8679e479b7 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Tue, 12 Jan 2016 15:28:00 +0000 Subject: [PATCH] Document setting up MEDIA_ROOT in the Django integration docs An out-of-the-box Django project is not configured to serve user-uploaded files from MEDIA_ROOT; this needs to be added manually as per https://docs.djangoproject.com/en/1.9/howto/static-files/#serving-files-uploaded-by-a-user-during-development . Fixes #2100 --- docs/getting_started/integrating_into_django.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/getting_started/integrating_into_django.rst b/docs/getting_started/integrating_into_django.rst index acc4081e1..b0bfdaa6c 100644 --- a/docs/getting_started/integrating_into_django.rst +++ b/docs/getting_started/integrating_into_django.rst @@ -82,6 +82,19 @@ The URL paths here can be altered as necessary to fit your project's URL scheme. In this case, this should be placed at the end of the ``urlpatterns`` list, so that it does not override more specific URL patterns. +Finally, your project needs to be set up to serve user-uploaded files from ``MEDIA_ROOT``. Your Django project may already have this in place, but if not, add the following snippet to ``urls.py``: + +.. code-block:: python + + from django.conf import settings + from django.conf.urls.static import static + + urlpatterns = [ + # ... the rest of your URLconf goes here ... + ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + +Note that this only works in development mode (``DEBUG = True``); in production, you will need to configure your web server to serve files from ``MEDIA_ROOT``. For further details, see the Django documentation: `Serving files uploaded by a user during development `_ and `Deploying static files `_. + With this configuration in place, you are ready to run ``./manage.py migrate`` to create the database tables used by Wagtail. User accounts