Ver a proveniência

Fix: Add a mark 'IS_TEST' to decide if we should load image-urls

pull/128/head
winkidney há 6 anos
ascendente
cometimento
ac469d47f9
4 ficheiros alterados com 14 adições e 1 eliminações
  1. +1
    -1
      django_images/urls.py
  2. +3
    -0
      manage.py
  3. +3
    -0
      pinry/settings/base.py
  4. +7
    -0
      pinry/urls.py

+ 1
- 1
django_images/urls.py Ver ficheiro

@@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.conf.urls import url
from . import views

urlpatterns = [


+ 3
- 0
manage.py Ver ficheiro

@@ -6,5 +6,8 @@ if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings.development")

from django.core.management import execute_from_command_line
if 'test' in sys.argv:
from django.conf import settings
settings.IS_TEST = True

execute_from_command_line(sys.argv)

+ 3
- 0
pinry/settings/base.py Ver ficheiro

@@ -134,5 +134,8 @@ IMAGE_SIZES = {
'square': {'crop': True, 'size': [125, 125]},
}

# IS_TEST is a variable to mark if the test is running
IS_TEST = False

# User custom settings
IMAGE_AUTO_DELETE = True

+ 7
- 0
pinry/urls.py Ver ficheiro

@@ -19,3 +19,10 @@ if settings.DEBUG:
urlpatterns += [
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT, }),
]

if settings.IS_TEST:
urlpatterns += staticfiles_urlpatterns()
# For test running of django_images
urlpatterns += [
url(r'^__images/', include('django_images.urls')),
]

Carregando…
Cancelar
Guardar