Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
108c04f5
Kaydet (Commit)
108c04f5
authored
Agu 23, 2018
tarafından
Alejandro Dubrovsky
Kaydeden (comit)
Tim Graham
Agu 23, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29570 -- Added check that MEDIA_URL isn't in STATIC_URL.
üst
c69d40f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
utils.py
django/contrib/staticfiles/utils.py
+5
-0
test_utils.py
tests/staticfiles_tests/test_utils.py
+14
-0
No files found.
django/contrib/staticfiles/utils.py
Dosyayı görüntüle @
108c04f5
...
...
@@ -52,6 +52,11 @@ def check_settings(base_url=None):
if
settings
.
MEDIA_URL
==
base_url
:
raise
ImproperlyConfigured
(
"The MEDIA_URL and STATIC_URL "
"settings must have different values"
)
if
(
settings
.
DEBUG
and
settings
.
MEDIA_URL
and
settings
.
STATIC_URL
and
settings
.
MEDIA_URL
.
startswith
(
settings
.
STATIC_URL
)):
raise
ImproperlyConfigured
(
"runserver can't serve media if MEDIA_URL is within STATIC_URL."
)
if
((
settings
.
MEDIA_ROOT
and
settings
.
STATIC_ROOT
)
and
(
settings
.
MEDIA_ROOT
==
settings
.
STATIC_ROOT
)):
raise
ImproperlyConfigured
(
"The MEDIA_ROOT and STATIC_ROOT "
...
...
tests/staticfiles_tests/test_utils.py
0 → 100644
Dosyayı görüntüle @
108c04f5
from
django.contrib.staticfiles.utils
import
check_settings
from
django.core.exceptions
import
ImproperlyConfigured
from
django.test
import
SimpleTestCase
,
override_settings
class
CheckSettingsTests
(
SimpleTestCase
):
@override_settings
(
DEBUG
=
True
,
MEDIA_URL
=
'/static/media/'
,
STATIC_URL
=
'/static/'
,)
def
test_media_url_in_static_url
(
self
):
msg
=
"runserver can't serve media if MEDIA_URL is within STATIC_URL."
with
self
.
assertRaisesMessage
(
ImproperlyConfigured
,
msg
):
check_settings
()
with
self
.
settings
(
DEBUG
=
False
):
# Check disabled if DEBUG=False.
check_settings
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment