Ajout de MEDIA_{ROOT,URL}

This commit is contained in:
Théophile Bastian 2016-07-09 18:49:38 +01:00
parent 58cade22d3
commit cd73d4e96d
3 changed files with 17 additions and 1 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ settings.py
venv/
.vagrant
/src
media/

View file

@ -116,6 +116,12 @@ USE_TZ = True
STATIC_URL = '/static/'
# Media upload (through ImageField, SiteField)
# https://docs.djangoproject.com/en/1.9/ref/models/fields/
MEDIA_ROOT = './media/'
MEDIA_URL = '/media/'
# Various additional settings
SITE_ID = 1

View file

@ -1,4 +1,8 @@
# -*-coding:utf-8 -*
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
import autocomplete_light
@ -69,4 +73,9 @@ urlpatterns = patterns(
url(r'^utile_bda/bda_diff$', 'gestioncof.views.liste_bdadiff'),
url(r'^utile_cof/diff_cof$', 'gestioncof.views.liste_diffcof'),
url(r'^utile_bda/bda_revente$', 'gestioncof.views.liste_bdarevente'),
)
) + \
(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG
else [])
# Si on est en production, MEDIA_ROOT est servi par Apache.
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.