mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 17:36:49 +01:00
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
This commit is contained in:
parent
9bd91a02e3
commit
aea3ce67a0
@ -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.
|
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 <https://docs.djangoproject.com/en/1.9/howto/static-files/#serving-files-uploaded-by-a-user-during-development>`_ and `Deploying static files <https://docs.djangoproject.com/en/1.9/howto/static-files/deployment/>`_.
|
||||||
|
|
||||||
With this configuration in place, you are ready to run ``./manage.py migrate`` to create the database tables used by Wagtail.
|
With this configuration in place, you are ready to run ``./manage.py migrate`` to create the database tables used by Wagtail.
|
||||||
|
|
||||||
User accounts
|
User accounts
|
||||||
|
Loading…
Reference in New Issue
Block a user