How to remove the language identifier from django-cms 2.4 URLs?

@ppetrid's answer is still correct. However, as of Django 1.6 patterns is no longer available. Change the existing code to this:

from django.conf.urls import patterns

urlpatterns = (
  url(r'^admin/', include(admin.site.urls)),
  url(r'^', include('cms.urls')),
)

You will also get a warning if you leave the '', in the patterns too.


Option 1:

Set USE_I18N = False in your settings file.

Django’s internationalization hooks are on by default... If you don’t use internationalization, you should take the two seconds to set USE_I18N = False in your settings file. [Django documentation:Translation]

The internationalization is "inherited" from Django. Django-cms 2.4 uses Django 1.5 which supports internationalization and the use of USE_I18N flag. The flag has been used in all successive django releases.

Option 2:

replace this pattern registration:

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

with this:

from django.conf.urls import patterns

urlpatterns = patterns('',
  url(r'^admin/', include(admin.site.urls)),
  url(r'^', include('cms.urls')),
)

The tutorial you pointed to uses the i18n_patterns method which does exactly this: prepends the language code to your urls.

Also note you can safely remove 'django.middleware.locale.LocaleMiddleware' and 'cms.middleware.language.LanguageCookieMiddleware' from your MIDDLEWARE_CLASSES if you will not use multiple languages.