Navigation Menu

Skip to content

Commit

Permalink
update testproject settings and urls for django 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaoming committed Dec 26, 2015
1 parent 02e7d51 commit cd9533b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
47 changes: 25 additions & 22 deletions testproject/testproject/settings/__init__.py
Expand Up @@ -5,7 +5,6 @@
PROJECT_PATH = os_path.abspath(os_path.split(os_path.dirname(__file__))[0])

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_email@example.com'),
Expand Down Expand Up @@ -47,12 +46,6 @@
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = [
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand All @@ -68,23 +61,33 @@
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'testproject.wsgi.application'

TEMPLATE_DIRS = (
os_path.join(PROJECT_PATH, 'templates'),
)

TEMPLATE_CONTEXT_PROCESSORS = [
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.core.context_processors.debug',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'sekizai.context_processors.sekizai',
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': (os_path.join(PROJECT_PATH, 'templates'),),
'OPTIONS': {
'context_processors': [
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.request",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"sekizai.context_processors.sekizai",
],
'debug': DEBUG,
}
},
]

# Setting this dynamically:
# for template_engine in TEMPLATES:
# template_engine['OPTIONS']['debug'] = True


INSTALLED_APPS = [
'django.contrib.humanize',
'django.contrib.auth',
Expand Down
7 changes: 3 additions & 4 deletions testproject/testproject/urls.py
Expand Up @@ -3,22 +3,21 @@
from django.conf.urls import include, url
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from django.contrib import admin
from django.http.response import HttpResponse
from django.views.static import serve as static_serve

admin.autodiscover()

urlpatterns = [
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^robots.txt', lambda _: HttpResponse('User-agent: *\nDisallow: /')),
]

if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
urlpatterns += [
url(r'^media/(?P<path>.*)$',
'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
url(r'^media/(?P<path>.*)$', static_serve, {'document_root': settings.MEDIA_ROOT}),
]

from wiki.urls import get_pattern as get_wiki_pattern
Expand Down

0 comments on commit cd9533b

Please sign in to comment.