mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Code Updates for Django 1.8+
This commit is contained in:
parent
2595d22b90
commit
d2a704c075
4 changed files with 34 additions and 26 deletions
|
@ -25,7 +25,6 @@ if not os.path.exists(VAR_ROOT):
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
# Local time zone for this installation. Choices can be found here:
|
# Local time zone for this installation. Choices can be found here:
|
||||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||||
|
@ -95,15 +94,24 @@ MIDDLEWARE_CLASSES = (
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
)
|
)
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS += (
|
|
||||||
'django.core.context_processors.request',
|
TEMPLATES = [
|
||||||
'django.core.context_processors.i18n',
|
{
|
||||||
)
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
|
|
||||||
'mptt',
|
'mptt',
|
||||||
'gunicorn',
|
'gunicorn',
|
||||||
'dpaste',
|
'dpaste',
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
from django.conf.urls import url, patterns, include
|
from django.conf.urls import url, include
|
||||||
|
|
||||||
urlpatterns = patterns(
|
urlpatterns = [
|
||||||
'',
|
|
||||||
url(r'^', include('dpaste.urls.dpaste_api')),
|
url(r'^', include('dpaste.urls.dpaste_api')),
|
||||||
url(r'^', include('dpaste.urls.dpaste')),
|
url(r'^', include('dpaste.urls.dpaste')),
|
||||||
|
url(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
(r'^i18n/', include('django.conf.urls.i18n')),
|
]
|
||||||
)
|
|
||||||
|
|
||||||
# Custom error handlers which load `dpaste/<code>.html` instead of `<code>.html`
|
# Custom error handlers which load `dpaste/<code>.html` instead of `<code>.html`
|
||||||
handler404 = 'dpaste.views.page_not_found'
|
handler404 = 'dpaste.views.page_not_found'
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import url
|
||||||
|
|
||||||
|
from .. import views
|
||||||
|
|
||||||
L = getattr(settings, 'DPASTE_SLUG_LENGTH', 4)
|
L = getattr(settings, 'DPASTE_SLUG_LENGTH', 4)
|
||||||
|
|
||||||
urlpatterns = patterns('dpaste.views',
|
urlpatterns = [
|
||||||
url(r'^about/$', 'about', name='dpaste_about'),
|
url(r'^about/$', views.about, name='dpaste_about'),
|
||||||
|
|
||||||
url(r'^$', 'snippet_new', name='snippet_new'),
|
url(r'^$', views.snippet_new, name='snippet_new'),
|
||||||
url(r'^diff/$', 'snippet_diff', name='snippet_diff'),
|
url(r'^diff/$', views.snippet_diff, name='snippet_diff'),
|
||||||
url(r'^history/$', 'snippet_history', name='snippet_history'),
|
url(r'^history/$', views.snippet_history, name='snippet_history'),
|
||||||
url(r'^delete/$', 'snippet_delete', name='snippet_delete'),
|
url(r'^delete/$', views.snippet_delete, name='snippet_delete'),
|
||||||
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/?$' % L, 'snippet_details', name='snippet_details'),
|
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/?$' % L, views.snippet_details, name='snippet_details'),
|
||||||
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/delete/$' % L, 'snippet_delete', name='snippet_delete'),
|
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/delete/$' % L, views.snippet_delete, name='snippet_delete'),
|
||||||
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/gist/$' % L, 'snippet_gist', name='snippet_gist'),
|
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/gist/$' % L, views.snippet_gist, name='snippet_gist'),
|
||||||
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/raw/?$' % L, 'snippet_details', {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'),
|
url(r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/raw/?$' % L, views.snippet_details, {'template_name': 'dpaste/snippet_details_raw.html', 'is_raw': True}, name='snippet_details_raw'),
|
||||||
)
|
]
|
||||||
|
|
|
@ -2,6 +2,6 @@ from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from ..views import snippet_api
|
from ..views import snippet_api
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = [
|
||||||
url(r'^api/$', snippet_api, name='dpaste_api_create_snippet'),
|
url(r'^api/$', snippet_api, name='dpaste_api_create_snippet'),
|
||||||
)
|
]
|
||||||
|
|
Loading…
Reference in a new issue