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
09b3e466
Kaydet (Commit)
09b3e466
authored
Agu 18, 2017
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27796 -- Prevented middleware being loaded twice with runserver
Thanks Tim Graham for the review.
üst
f2b93b50
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
handlers.py
django/contrib/staticfiles/handlers.py
+5
-0
test_management.py
tests/staticfiles_tests/test_management.py
+12
-1
No files found.
django/contrib/staticfiles/handlers.py
Dosyayı görüntüle @
09b3e466
...
...
@@ -21,6 +21,11 @@ class StaticFilesHandler(WSGIHandler):
self
.
base_url
=
urlparse
(
self
.
get_base_url
())
super
()
.
__init__
()
def
load_middleware
(
self
):
# Middleware are already loaded for self.application; no need to reload
# them for self.
pass
def
get_base_url
(
self
):
utils
.
check_settings
()
return
settings
.
STATIC_URL
...
...
tests/staticfiles_tests/test_management.py
Dosyayı görüntüle @
09b3e466
...
...
@@ -11,7 +11,9 @@ from admin_scripts.tests import AdminScriptTestCase
from
django.conf
import
settings
from
django.contrib.staticfiles
import
storage
from
django.contrib.staticfiles.management.commands
import
collectstatic
from
django.contrib.staticfiles.management.commands
import
(
collectstatic
,
runserver
,
)
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.management
import
call_command
from
django.test
import
override_settings
...
...
@@ -34,6 +36,15 @@ class TestNoFilesCreated:
self
.
assertEqual
(
os
.
listdir
(
settings
.
STATIC_ROOT
),
[])
class
TestRunserver
(
StaticFilesTestCase
):
@override_settings
(
MIDDLEWARE
=
[
'django.middleware.common.CommonMiddleware'
])
def
test_middleware_loaded_only_once
(
self
):
command
=
runserver
.
Command
()
with
mock
.
patch
(
'django.middleware.common.CommonMiddleware'
)
as
mocked
:
command
.
get_handler
(
use_static_handler
=
True
,
insecure_serving
=
True
)
self
.
assertEqual
(
mocked
.
call_count
,
1
)
class
TestFindStatic
(
TestDefaults
,
CollectionTestCase
):
"""
Test ``findstatic`` management command.
...
...
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