Upgrading from 2.1.x and Django 1.2.x

Upgrading dependencies

Upgrade both your version of django CMS and Django by running the following commands.

  1. pip install --upgrade django-cms==2.2 django==1.3.1

If you are using django-reversion make sure to have at least version 1.4 installed

  1. pip install --upgrade django-reversion==1.4

Also, make sure that django-mptt stays at a version compatible with django CMS

  1. pip install --upgrade django-mptt==0.5.1

Updates to settings.py

The following changes will need to be made in your settings.py file:

  1. ADMIN_MEDIA_PREFIX = '/static/admin'
  2. STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
  3. STATIC_URL = "/static/"

Note

These are not django CMS settings. Refer to the Django documentation on staticfiles for more information.

Note

Please make sure the static sub-folder exists in your project and is writeable.

Note

PROJECT_PATH is the absolute path to your project. See Configuring your project for django CMS for instructions on how to set PROJECT_PATH.

Remove the following from TEMPLATE_CONTEXT_PROCESSORS:

django.core.context_processors.auth

Add the following to TEMPLATE_CONTEXT_PROCESSORS:

  1. django.contrib.auth.context_processors.auth
  2. django.core.context_processors.static
  3. sekizai.context_processors.sekizai

Remove the following from MIDDLEWARE_CLASSES:

  1. cms.middleware.media.PlaceholderMediaMiddleware

Remove the following from INSTALLED_APPS:

  1. publisher

Add the following to INSTALLED_APPS:

  1. sekizai
  2. django.contrib.staticfiles

Template Updates

Make sure to add sekizai tags and cms_toolbar to your CMS templates.

Note

cms_toolbar is only needed if you wish to use the front-end editing. See Backwards incompatible changes for more information

Here is a simple example for a base template called base.html:

  1. {% load cms_tags sekizai_tags %}
  2. <html>
  3. <head>
  4. {% render_block "css" %}
  5. </head>
  6. <body>
  7. {% cms_toolbar %}
  8. {% placeholder base_content %}
  9. {% block base_content%}{% endblock %}
  10. {% render_block "js" %}
  11. </body>
  12. </html>

Database Updates

Run the following commands to upgrade your database

  1. python manage.py syncdb
  2. python manage.py migrate

Static Media

Add the following to urls.py to serve static media when developing:

  1. if settings.DEBUG:
  2. urlpatterns = patterns('',
  3. url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
  4. {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
  5. url(r'', include('django.contrib.staticfiles.urls')),
  6. ) + urlpatterns

Also run this command to collect static files into your STATIC_ROOT:

  1. python manage.py collectstatic