Skip to content

Commit

Permalink
Upgrade Django from 1.8.x to 1.11
Browse files Browse the repository at this point in the history
Django 1.11 is the next LTS release of Django and the last release to
support Python 2. Luckily, Django 1.11 will be supported with security
updates until sometime in 2020 so there's no immediate rush to rewrite
everything to Python 3 just yet.

Still, Django 1.8 will soon stop getting security updates, so upgrading
to Django 1.11 now means it will still be easy to take in new Django
Security fixes.

Migrating was fairly straight-forward, and involved reading the release
notes of Django 1.9, 1.10 and 1.11, as well as upgrading any third-party
libs that had released compatibility updates for Django 1.11:

- https://docs.djangoproject.com/en/1.11/releases/1.9/
- https://docs.djangoproject.com/en/1.11/releases/1.10/
- https://docs.djangoproject.com/en/1.11/releases/1.11/
  • Loading branch information
stianjensen authored and lionleaf committed Oct 18, 2018
1 parent 1cb6b98 commit 3637eea
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
5 changes: 1 addition & 4 deletions dwitter/dweet/views.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from django.shortcuts import get_object_or_404, render
from dwitter.models import Dweet
from django.views.decorators.clickjacking import xframe_options_exempt
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.cache import cache_page


def handler404(request):
response = render_to_response('404_dweet.html', {},
context_instance=RequestContext(request))
response = render(request, '404_dweet.html')
response.status_code = 404
return response

Expand Down
2 changes: 1 addition & 1 deletion dwitter/feed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_queryset(self):
queryset
.select_related('author')
.select_related('reply_to')
.select_related('reply_to__author__username')
.select_related('reply_to__author')
.prefetch_related('comments'))

return queryset
Expand Down
16 changes: 4 additions & 12 deletions dwitter/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@
ALLOWED_HOSTS = []


TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
},
]


# Application definition

INSTALLED_APPS = [
Expand All @@ -62,15 +54,16 @@
'corsheaders',
]

DBBACKUP_STORAGE = 'dbbackup.storage.filesystem_storage'
DBBACKUP_STORAGE = 'django.core.files.storage.FileSystemStorage'
DBBACKUP_STORAGE_OPTIONS = {'location': 'backups'}

REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
'PAGE_SIZE': 10, # Default to 10
'MAX_PAGE_SIZE': 100, # Maximum limit allowed when using `?page_size=xxx`.
'DEFAULT_RENDERER_CLASSES': ('rest_framework.renderers.JSONRenderer',),

}

# List of callables that know how to import templates from various sources.
Expand All @@ -80,7 +73,7 @@
# # 'django.template.loaders.eggs.Loader',
# )

MIDDLEWARE_CLASSES = [
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'subdomains.middleware.SubdomainURLRoutingMiddleware',
Expand Down Expand Up @@ -113,7 +106,6 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
],
},
},
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
boto==2.42
django-anymail==4.3
django-compressor==2.1
django-dbbackup==2.5.0
django-compressor==2.2
django-dbbackup==3.0.2
django-debug-toolbar==1.9.1
django-filter==0.13
django-registration-redux==1.2
django-filter==1.1
django-registration-redux==1.8
django-storages-redux==1.3.2
django-subdomains==2.1.0rc0
django==1.8.14
djangorestframework==3.3.3
django==1.11.15
djangorestframework==3.7.1
flake8==2.6.2
newrelic==4.2.0.100
django-cors-headers==2.4.0

0 comments on commit 3637eea

Please sign in to comment.