Django CMS page tree default language - django

It seems I don't understand how to set the default language for Django CMS. I want the default language to be set to Dutch. However, for an unknown reason, it always defaults to English when creating or after modifying/editing a Page.
Take the following scenario. I open the Page tree. English is selected by default. I select Dutch. I edit this page. I publish it. I click on edit, it opens the English page which is empty.
Take another scenario. I open the Page tree. I create a new page. By default it opens for the English variant.
Note: All cookies were removed as suggested in the documentation.
Please advise how I can set the default language to Dutch?
The settings:
from django.utils.translation import gettext_lazy as _
LANGUAGE_CODE = "nl"
SITE_ID = 1
USE_I18N = True
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.common.BrokenLinkEmailsMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
]
LANGUAGES = [
('nl', 'Dutch'),
('en', 'English'),
]
CMS_LANGUAGES = {
1: [
{
'code': 'nl',
'name': _('Dutch'),
'fallbacks': ['en', ],
'public': True,
'hide_untranslated': True,
'redirect_on_fallback': False,
},
{
'code': 'en',
'name': _('English'),
'public': True,
},
],
'default': {
'fallbacks': ['nl', 'en'],
'redirect_on_fallback': False,
'public': True,
'hide_untranslated': True,
}
}

I fixed the problem as follows per the documentation:
# urls.py
from django.conf.urls.i18n import i18n_patterns
from django.views.i18n import JavaScriptCatalog
# ...
admin.autodiscover()
urlpatterns = i18n_patterns(
re_path(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
)
# Note the django CMS URLs included via i18n_patterns
urlpatterns += i18n_patterns(
path(settings.ADMIN_URL, admin.site.urls),
re_path(r'^', include('cms.urls')),
)
urlpatterns += [
...
]
This setup introduces other minor issues that need to be fixed. But in general, this is the solution.
On another note, not sure though as to why this part is needed:
re_path(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog')

Related

400 Bad Request Django/React

I have built a server with Django and I am receiving a 400 Bad Request within Postman when I check the POST method. However, it is displaying the JSON data within the Postman as well.
Originally, I thought it was a frontend issue, because my console log was stating
AxiosError {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}
As I stated before, the error is showing in Postman so I'm assuming it's actually a server issue.
Im real "finicky" when it comes to file colors, and if it is any color than the default color, I feel like there is errors within the file. Could these orange/beige files contain the problem? If I click on one of those files Im met with:
The file is not displayed in the editor because it is either binary or uses an unsupported text encoding.
Because I am new to django, I don't want to do something that's going to create an even bigger problem than what I already have.
Below will be my settings.py
"""
Django settings for django_rest_api project.
Generated by 'django-admin startproject' using Django 4.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-2r=5^!2(nj*^*m*sa_39h(xldjpau&$wmn&pc5=^frws#w&25="
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
"corsheaders",
"rest_framework",
"todo_api",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
CORS_ALLOW_ALL_ORIGINS = True
ROOT_URLCONF = "django_rest_api.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
WSGI_APPLICATION = "django_rest_api.wsgi.application"
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "todo_api",
"USER": "",
"PASSWORD" : '',
"HOST": "localhost"
}
}
# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = "static/"
# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
Below is my views.py
from django.shortcuts import render
from rest_framework import generics
from .serializer import TodoSerializer
from .models import Todo
# Create your views here.
class TodoList(generics.ListCreateAPIView):
queryset = Todo.objects.all().order_by('id')
serializer_class = TodoSerializer
class TodoDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Todo.objects.all().order_by('id')
serializer_class = TodoSerializer
Im not exactly sure what information everyone needs to provide a proper solution for this, but hopefully I have provided more than enough.
I think it is worth noting that I am using postgreql and my database is working properly, and I can access Django admin and manually enter data from there as well.

Django Rest Framework: backend not found

I'm trying to create and authentication with github account to DRF.
why i get 404 error and can't get to github authentication page?
I provided the code extracts. If any information is required or you have any questions please let me know.
Here's the views.py
class BookViewSet(ModelViewSet):
queryset = Book.objects.all()
serializer_class = BooksSerializer
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
permission_classes = [IsAuthenticated]
filterset_fields = ['price']
search_fields = ['name', 'author_name']
ordering_fields = ['price', 'author_name']
def auth(request):
return render(request, 'oauth.html')
And here's the settings.py
# Application definition
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
'social_django',
'store',
]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "books.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": ['templates'],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'books_db',
'USER': 'books_user',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
'TEST': {
'NAME': 'test_finance',
},
}
}
AUTHENTICATION_BACKENDS = (
'social_core.backends.github.GithubOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
),
'DEFAULT_PARSER_CLASSES': (
'rest_framework.parsers.JSONParser',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated', )
}
SOCIAL_AUTH_POSTGRES_JSONFIELD = True
SOCIAL_AUTH_GITHUB_KEY = '-some github key'
SOCIAL_AUTH_GITHUB_SECRET = 'git secret'
My urls.py
router = SimpleRouter()
router.register(r'book', BookViewSet)
urlpatterns = [
path("admin/", admin.site.urls),
re_path('', include('social_django.urls', namespace='social')),
path('auth/',auth)
]
urlpatterns += router.urls
And a very simple template
oauth.html
Github
Page not found (404)
Backend not found
Request Method: GET
Request URL: http://127.0.0.1:8000/login/github-oauth2/
Raised by: social_django.views.auth
Using the URLconf defined in books.urls, Django tried these URL patterns, in this order:
admin/
login/str:backend/ [name='begin']
The current path, login/github-oauth2/, matched the last one.
You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

How can I open Django app page within the domain name, not like domain/app_page_url?

Python == 3.6.5
Django == 1.8
Recently purchased domain name, http://www.favourite.uz. And placed my Django project to my hosting in cPanel. When I browse domain http://www.favourite.uz, it throws to default page of cPanel. But when try http://www.favourite.uz/news it opens my django app. I wanted to browse this http://www.favourite.uz/news page within the domain name, without /news.
I placed used server's namespaces in Domain registrator's page. Tried to create another simple project from this tutorial,https://www.youtube.com/watch?v=ffqMZ5IcmSY. But it still opens default page of cPanel.
Main favourite/urls.py
# from django.urls import path
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.static import serve
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^news/', include('news.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
]
if settings.DEBUG is False:
urlpatterns += [
url(r'^media/(?P<path>.*)$', serve, {
'document_root' : settings.MEDIA_ROOT,}),
]
(news)app url, news/urls.py
from . import views
urlpatterns =[
url(r'^$', views.NewsView.as_view(), name='posts'),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^index', views.search, name="search"),
url(r'^chaining/', include('smart_selects.urls')),
url(r'^league/(?P<pk>[0-9]+)/$', views.league_detail, name='league_detail'),
]
settings, favourite/settings.py
Django settings for futbik_version_7 project.
Generated by 'django-admin startproject' using Django 2.0.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
from django.utils.translation import ugettext_lazy as _
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = "/media/"
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
STATIC_URL = '/static/'
STATIC_ROOT = 'news/static/'
STATICFILES_DIRS =(
os.path.join(BASE_DIR,'news/static/images'),
)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'az=5ur80-1ge#!951w3(bxaqg1zwo1+a#6+*s*dw(sgkywhb3z'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'www.favourite.uz', 'favourite.uz']
# Application definition
INSTALLED_APPS = [
'modeltranslation',
'news.apps.NewsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_userforeignkey',
'simplesearch',
'smart_selects',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_userforeignkey.middleware.UserForeignKeyMiddleware',
'django.middleware.locale.LocaleMiddleware',
]
LANGUAGES = (
('en', _('Uzbek')),
('ru', _('Русский')),
)
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
)
# MODELTRANSLATION_DEFAULT_LANGUAGE = 'en'
# MODELTRANSLATION_TRANSLATION_REGISTRY = 'news.translation'
ROOT_URLCONF = 'futbik_version_7.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
# os.path.join(BASE_DIR, 'news/templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'news.context_processors.add_variable_to_context',
],
},
},
]
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.i18n',
)
WSGI_APPLICATION = 'futbik_version_7.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# SOUTH_DATABASE_ADAPTERS = {
# 'default': 'south.db.sqlite3'
# }
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'en'
TIME_ZONE = 'Asia/Tashkent'
USE_I18N = True
USE_L10N = True
USE_TZ = True
USE_DJANGO_JQUERY = False
# MODELTRANSLATION_DEBUG = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
I really appreciate, if someone encountered such situation and helps me to solve this little problem.
P.s. I am beginner in Django!
Try adding a redirect URL to your urls, so that / redirects to /news. In favourite/urls.py, add this:
from django.views.generic import RedirectView
url_patterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^news/', include('news.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^$', RedirectView.as_view(pattern_name='posts', permanent=True)) # <—- add this line
]
This should work.
I just find it strange that instead of showing a 404 not found, cPanel seems to hijack the missing page. If my method doesn't work, you should contact cPanel support and ask how to enable the default domain to be routed to your app.

Django translations not working with Django-cms and djangocms-blog

I have a problem with my Django Translations.
My Django doesn't translate my tags.
I use django-cms and in django-cms I have a plugin djangocms-blog.
Django == 1.6.5
Django-cms == 3.0.3
Djangocms-blog == 0.2b5
My transtags are not translated.
Example tag:
{% trans "read more" %}
I installed everything correctly, my settings.py contains this:
gettext = lambda s: s
# Internationalization
LANGUAGE_CODE = 'nl'
TIME_ZONE = 'Europe/Brussels'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
)
LANGUAGES = (
('nl', _(u'Dutch')),
('fr', _(u'French')),
('en', _(u'English')),
)
CMS_LANGUAGES = {
1: [
{
'code': 'nl',
'name': gettext('Dutch'),
'fallbacks': ['en', 'fr'],
'public': True,
'hide_untranslated': True,
'redirect_on_fallback':False,
},
{
'code': 'en',
'name': gettext('English'),
'fallbacks': ['nl'],
'public': False,
'hide_untranslated': True,
'redirect_on_fallback':False,
},
{
'code': 'fr',
'name': gettext('French'),
'public': False,
'hide_untranslated': True,
},
],
2: [
{
'code': 'nl',
'name': gettext('Dutch'),
'public': True,
'fallbacks': ['en'],
},
],
'default': {
'fallbacks': ['en', 'fr'],
'redirect_on_fallback': True,
'public': False,
'hide_untranslated': False,
}
}
In My Middleware classes:
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
)
My urls.py:
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = i18n_patterns(
'',
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^admin/', include(admin.site.urls)),
url(r'^products/', include('catalog.urls')),
url(r'^contact/', 'contact.views.contact'),
url(r'^pages/', include('django.contrib.flatpages.urls')),
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
url(r'^', include('cms.urls')),
)
if settings.DEBUG:
import debug_toolbar
urlpatterns = i18n_patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)),
url(r'^404/$', 'django.views.defaults.page_not_found'), # TODO MOET NOG VERPLAATST WORDEN
url(r'^500/$', 'django.views.defaults.server_error'), # TODO MOET NOG VERPLAATST WORDEN
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns
In my blog_items.html page (a page from the djangocms-blog plugin template that I override)
{% load i18n thumbnail cms_tags %}
{% load url from future %}
I created my languages within the virtual env by
Going to the virtual env by "workon app"
I run the command django-admin.py makemessages -l nl (the po files are created correctly)
I run the command django-admin.py compilemessages and everything seems fine
In the root of my program is the locale folder with 3 subfolders: en, fr and nl. They contain all the LC_MESSAGES folder with a django.mo and django.po file with the correct message strings.
#: .\templates\djangocms_blog\includes\blog_item.html:37 #, fuzzy
msgid "read more"
msgstr "lees meer"
This is solved.
First of all the fuzzy had to be removed.
I had to add the parler settings correct into my general settings:
In the documentation of Django-parler (https://pypi.python.org/pypi/django-parler ) they suggest the next settings:
PARLER_LANGUAGES = {
None: (
{'code': 'nl',},
{'code': 'en',},
{'code': 'fr',},
),
}
Instead of
PARLER_LANGUAGES = {
1: (
{'code': 'nl',},
{'code': 'en',},
{'code': 'fr',},
),
}
AFAIK translations marked as fuzzy are not compiled in the mo files and you must "unfuzzy" them before being available

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

I have followed the tutorial to make a new Django-CMS (2.4) site. I am only using a single language (English).
There is an automatic redirect to include the language identifier '/en/' in my site's URLs. How do I remove it?
thanks.
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.
#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.
In django version 1.8.18 you just need to put False at this variable in settings.py
USE_I18N = False
USE_L10N = False
If you want to keep one language in the URL, for instance because you have backlinks in the web with the language code, you can simply take out the other language in settings.py
LANGUAGES = (
#('en', gettext('en')),
('de', gettext('de')),
)
CMS_LANGUAGES = {
'default': {
'public': True,
'hide_untranslated': False,
'redirect_on_fallback': True,
},
1: [
{
'public': True,
'code': 'de',
'hide_untranslated': False,
'name': gettext('de'),
'redirect_on_fallback': True,
},
# {
# 'public': True,
# 'code': 'en',
# 'hide_untranslated': False,
# 'name': gettext('en'),
# 'fallbacks': ['de'],
# 'redirect_on_fallback': True,
# },
],
}
That way the URL still shows www.example.com/de/foo.html. In the Example above, that /de/ will be lost, which will render all your URLs in the web meaningless.
Thus, from an SEO perspective, it might not be the best option if you have already built up links with the language code in it.