Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Updating django-cms to use django 1.10

Upgrading djangocms-installer scaffolded project django version


I used djangocms-installer to bootstrap django-cms project. Installer saves a great deal of time spent on intialization but its requirements.txt are outdated. As of Feb 15 2016 it enforces django<1.9 and other package requirements. This is because django-cms didn't officially support django>1.10 at a time last djangocms-installer version was released.

This article describes how I updated generated project to support django=>1.10.


  1. Update requirements.txt. Replace version for these packages:

  2. Update & migrate

    Update installed packages

    pip install --upgrade -r requirements.txt

    Apply migrations

    python migrate
  3. Replace django.core.context_processors -> django.template.context_processors in this section:

            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [os.path.join(BASE_DIR, 'project', 'templates'),],
            'OPTIONS': {
                'context_processors': [
                    'loaders': [

    Here we replace string view import paths with views themselves(import and pass callable)

    Add imports:

    from django.contrib.sitemaps.views import sitemap
    from django.views.static import serve as static_serve

    Update sitemap definition

    urlpatterns = [
        url(r'^sitemap\.xml$', sitemap,
            {'sitemaps': {'cmspages': CMSSitemap}}),

    Remove empty string('') from i18n_patterns call:

    urlpatterns += i18n_patterns(
        url(r'^admin/', include(,  # NOQA
        url(r'^', include('cms.urls')),

    Replace static serve import path string with view

    # This is only needed when using runserver.
    if settings.DEBUG:
        urlpatterns = [
            url(r'^media/(?P<path>.*)$', static_serve,
                {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
            ] + staticfiles_urlpatterns() + urlpatterns

Et voilà!


This comment has been minimized.

Copy link

@Chematronix Chematronix commented Sep 30, 2017

As of September 2017, you can specify which Django you want to the DjangoCMS installer, like this:

djangocms --django-version=1.10 --skip-empty-check --bootstrap yes --starting-page yes --filer --verbose --no-input --languages es,en --parent-dir . MyProject

Note that by default it will install the last Django LTS version supported by DjangoCMS (that'd be 1.8 ATM).


This comment has been minimized.

Copy link

@Nocks Nocks commented Oct 7, 2017

@Chematronix Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.