divio / django-cms-explorer

django CMS explorer theme example
30 stars 23 forks source link

Menubar return error in django cms #5

Closed kartikdanidhariya closed 8 years ago

kartikdanidhariya commented 8 years ago

hi, i install django using djangocms-installer my pip freeze is Django==1.8.8 Django-Select2==4.3.2 Pillow==3.1.0 Unidecode==0.04.19 argparse==1.2.1 cmsplugin-filer==1.0.1 dj-database-url==0.3.0 django-appconf==1.0.1 django-classy-tags==0.7.1 django-cms==3.2.0 django-filer==1.1.1 django-formtools==1.0 django-mptt==0.8.0 django-polymorphic==0.8.1 django-reversion==1.8.7 django-sekizai==0.9.0 django-treebeard==4.0 djangocms-admin-style==1.0.9 djangocms-column==1.6.0 djangocms-googlemap==0.4.0 djangocms-inherit==0.1.1 djangocms-installer==0.8.5 djangocms-link==1.7.1 djangocms-style==1.6.0 djangocms-text-ckeditor==2.8.1 easy-thumbnails==2.3 html5lib==0.9999999 pytz==2015.7 six==1.10.0 tzlocal==1.2 wsgiref==0.1.2

after i create one project in that and place all static files in static folder and also place directory like templates , tools ,private in project after in home page it return error like

ValueError at /en/ dictionary update sequence element #0 has length 5; 2 is required

my trace back is

Environment:

Request Method: GET Request URL: http://127.0.0.1:8000/en/

Django Version: 1.8.8 Python Version: 2.7.3 Installed Applications: ('djangocms_admin_style', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.sites', 'django.contrib.sitemaps', 'django.contrib.staticfiles', 'django.contrib.messages', 'cms', 'menus', 'sekizai', 'treebeard', 'djangocms_text_ckeditor', 'djangocms_style', 'djangocms_column', 'filer', 'easy_thumbnails', 'cmsplugin_filer_image', 'cmsplugin_filer_file', 'cmsplugin_filer_folder', 'cmsplugin_filer_teaser', 'cmsplugin_filer_utils', 'cmsplugin_filer_video', 'djangocms_googlemap', 'djangocms_inherit', 'djangocms_link', 'reversion', 'deldecam') Installed Middleware: ('cms.middleware.utils.ApphookReloadMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.page.CurrentPageMiddleware', 'cms.middleware.toolbar.ToolbarMiddleware', 'cms.middleware.language.LanguageCookieMiddleware')

Template error: In template /home/keyur/django_cms_3.2/delecam_no_boot/deldecam/templates/base.html, error at line 42 dictionary update sequence element #0 has length 5; 2 is required

32 :

  • {% trans "Contact" %}
  • 33 :

    34 :

    35 :

    52 :

    Traceback: File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response

    1. response = response.render() File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/response.py" in render
    2. self.content = self.rendered_content File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/response.py" in rendered_content
    3. content = template.render(context, self._request) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/backends/django.py" in render
    4. return self.template.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    5. return self._render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in _render
    6. return self.nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    7. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    8. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    9. return compiled_parent._render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in _render
    10. return self.nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    11. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    12. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    13. return compiled_parent._render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in _render
    14. return self.nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    15. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    16. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/classytags/core.py" in render
    17. return self.render_tag(context, **kwargs) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag
    18. rendered_contents = nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    19. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    20. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/classytags/core.py" in render
    21. return self.render_tag(context, **kwargs) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/cms/templatetags/cms_tags.py" in render_tag
    22. rendered_contents = nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    23. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    24. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    25. result = block.nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    26. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    27. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    28. result = block.nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    29. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    30. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    31. result = block.nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    32. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    33. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/classytags/core.py" in render
    34. return self.render_tag(context, **kwargs) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/cms/templatetags/cms_tags.py" in render_tag
    35. data['content'] = mark_safe(kwargs['nodelist'].render(data)) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    36. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    37. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
    38. return self.nodelist.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/base.py" in render
    39. bit = self.render_node(node, context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    40. return node.render(context) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/classytags/core.py" in render
    41. return self.render_tag(context, **kwargs) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/classytags/helpers.py" in render_tag
    42. flatten_context(self.get_context(context, **kwargs)) File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/classytags/utils.py" in flatten_context
    43. return context.flatten() File "/home/keyur/django_cms_3.2/local/lib/python2.7/site-packages/django/template/context.py" in flatten
    44. flat.update(d)

    Exception Type: ValueError at /en/ Exception Value: dictionary update sequence element #0 has length 5; 2 is required

    can you please explain how can i solve this

    FinalAngel commented 8 years ago

    hello @kartikdanidhariya, are your settings somewhat similar to https://github.com/divio/django-cms-demo/blob/master/src/settings.py ? Especially the template paths and BASE_DIR need to point to the correct place.

    I assume you were only using the djangocms-installer An other alternative would be the above mentioned demo project.

    kartikdanidhariya commented 8 years ago

    hi i try with that but not work my settings.py in

    import os gettext = lambda s: s DATA_DIR = os.path.dirname(os.path.dirname(file)) """ Django settings for deldecam project.

    Generated by 'django-admin startproject' using Django 1.8.8.

    For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/

    For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """

    Build paths inside the project like this: os.path.join(BASE_DIR, ...)

    import os

    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))

    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))

    DATA_DIR = os.path.join(BASE_DIR, 'data')

    Quick-start development settings - unsuitable for production

    See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

    SECURITY WARNING: keep the secret key used in production secret!

    SECRET_KEY = 'wyfyhlqc0d+^1090v=7%=yk$!txnqhyngj3grw5s192!p2ur'

    SECURITY WARNING: don't run with debug turned on in production!

    DEBUG = True

    ALLOWED_HOSTS = []

    Application definition

    ROOT_URLCONF = 'deldecam.urls'

    WSGI_APPLICATION = 'deldecam.wsgi.application'

    Database

    https://docs.djangoproject.com/en/1.8/ref/settings/#databases

    Internationalization

    https://docs.djangoproject.com/en/1.8/topics/i18n/

    LANGUAGE_CODE = 'en'

    TIME_ZONE = 'Asia/Kolkata'

    USE_I18N = True

    USE_L10N = True

    USE_TZ = True

    Static files (CSS, JavaScript, Images)

    https://docs.djangoproject.com/en/1.8/howto/static-files/

    STATIC_URL = '/static/' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(DATA_DIR, 'media') STATIC_ROOT = os.path.join(DATA_DIR, 'static')

    STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'deldecam', 'static'), ) SITE_ID = 1

    TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'deldecam', 'templates'), os.path.join(BASE_DIR, 'templates'),], 'OPTIONS': { 'context_processors': [ 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.i18n', 'django.core.context_processors.debug', 'django.core.context_processors.request', 'django.core.context_processors.media', 'django.core.context_processors.csrf', 'django.core.context_processors.tz', 'sekizai.context_processors.sekizai', 'django.core.context_processors.static', 'cms.context_processors.cms_settings' ], 'loaders': [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', 'django.template.loaders.eggs.Loader' ], }, }, ]

    MIDDLEWARE_CLASSES = ( 'cms.middleware.utils.ApphookReloadMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.page.CurrentPageMiddleware', 'cms.middleware.toolbar.ToolbarMiddleware', 'cms.middleware.language.LanguageCookieMiddleware' )

    INSTALLED_APPS = ( 'djangocms_admin_style', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.sites', 'django.contrib.sitemaps', 'django.contrib.staticfiles', 'django.contrib.messages', 'cms', 'menus', 'sekizai', 'treebeard', 'djangocms_text_ckeditor', 'djangocms_style', 'djangocms_column', 'filer', 'easy_thumbnails', 'cmsplugin_filer_image', 'cmsplugin_filer_file', 'cmsplugin_filer_folder', 'cmsplugin_filer_teaser', 'cmsplugin_filer_utils', 'cmsplugin_filer_video', 'djangocms_googlemap', 'djangocms_inherit', 'djangocms_link', 'reversion', 'deldecam', 'consulate_catalog', )

    LANGUAGES = (

    Customize this

    ('en', gettext('en')),
    ('fr', gettext('fr')),

    )

    CMS_LANGUAGES = {

    Customize this

    'default': {
        'public': True,
        'hide_untranslated': False,
        'redirect_on_fallback': True,
    },
    1: [
        {
            'public': True,
            'code': 'en',
            'hide_untranslated': False,
            'name': gettext('en'),
            'redirect_on_fallback': True,
        },
        {
            'public': True,
            'code': 'fr',
            'hide_untranslated': False,
            'name': gettext('fr'),
            'redirect_on_fallback': True,
        },
    ],

    }

    CMS_TEMPLATES = (

    Customize this

    ('fullwidth.html', 'Fullwidth'),
    ('sidebar_left.html', 'Sidebar Left'),
    ('sidebar_right.html', 'Sidebar Right')

    )

    CMS_PERMISSION = True

    CMS_PLACEHOLDER_CONF = {}

    DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'HOST': 'localhost', 'NAME': 'project.db', 'PASSWORD': '', 'PORT': '', 'USER': '' } }

    MIGRATION_MODULES = { 'cmsplugin_filer_image': 'cmsplugin_filer_image.migrations_django', 'cmsplugin_filer_file': 'cmsplugin_filer_file.migrations_django', 'cmsplugin_filer_folder': 'cmsplugin_filer_folder.migrations_django', 'cmsplugin_filer_video': 'cmsplugin_filer_video.migrations_django', 'cmsplugin_filer_teaser': 'cmsplugin_filer_teaser.migrations_django' }

    THUMBNAIL_PROCESSORS = ( 'easy_thumbnails.processors.colorspace', 'easy_thumbnails.processors.autocrop', 'filer.thumbnail_processors.scale_and_crop_with_subject_location', 'easy_thumbnails.processors.filters' )

    OPENERP_HOST = '75.99.235.10' OPENERP_PORT = '8069' OPENERP_DB = 'odoo9' OPENERP_UID = 'admin' OPENERP_PWD = 'admin'

    FinalAngel commented 8 years ago

    I did the following using the installer:

    virtualenv env
    source env/bin/activate
    pip install djangocms-installer
    djangocms -f -p . mysite

    after this follow the installation instructions, use just the defaults, type in "en" on language selection and then set your admin user / password.

    next copy all files into the mysite/ directory. It should look like:

    image

    My settings file:

    import os
    gettext = lambda s: s
    DATA_DIR = os.path.dirname(os.path.dirname(__file__))
    """
    Django settings for mysite project.
    
    Generated by 'django-admin startproject' using Django 1.8.8.
    
    For more information on this file, see
    https://docs.djangoproject.com/en/1.8/topics/settings/
    
    For the full list of settings and their values, see
    https://docs.djangoproject.com/en/1.8/ref/settings/
    """
    
    # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
    import os
    
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    
    # Quick-start development settings - unsuitable for production
    # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
    
    # SECURITY WARNING: keep the secret key used in production secret!
    SECRET_KEY = '9m8awp5ectxc89=56yn+6e@#e#6txerj6579ebpa7^2%5&b8ij'
    
    # SECURITY WARNING: don't run with debug turned on in production!
    DEBUG = True
    
    ALLOWED_HOSTS = []
    
    # Application definition
    
    ROOT_URLCONF = 'mysite.urls'
    
    WSGI_APPLICATION = 'mysite.wsgi.application'
    
    # Database
    # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
    
    # Internationalization
    # https://docs.djangoproject.com/en/1.8/topics/i18n/
    
    LANGUAGE_CODE = 'de'
    
    TIME_ZONE = 'Europe/Zurich'
    
    USE_I18N = True
    
    USE_L10N = True
    
    USE_TZ = True
    
    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.8/howto/static-files/
    
    STATIC_URL = '/static/'
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
    STATIC_ROOT = os.path.join(DATA_DIR, 'static')
    
    STATICFILES_DIRS = (
        os.path.join(BASE_DIR, 'mysite', 'static'),
    )
    SITE_ID = 1
    
    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [os.path.join(BASE_DIR, 'mysite', 'templates'),],
            'OPTIONS': {
                'context_processors': [
                    'django.contrib.auth.context_processors.auth',
        'django.contrib.messages.context_processors.messages',
        'django.core.context_processors.i18n',
        'django.core.context_processors.debug',
        'django.core.context_processors.request',
        'django.core.context_processors.media',
        'django.core.context_processors.csrf',
        'django.core.context_processors.tz',
        'sekizai.context_processors.sekizai',
        'django.core.context_processors.static',
        'cms.context_processors.cms_settings'
                ],
                'loaders': [
                    'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
        'django.template.loaders.eggs.Loader'
                ],
            },
        },
    ]
    
    MIDDLEWARE_CLASSES = (
        'cms.middleware.utils.ApphookReloadMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'django.middleware.locale.LocaleMiddleware',
        'django.middleware.common.CommonMiddleware',
        'django.middleware.clickjacking.XFrameOptionsMiddleware',
        'cms.middleware.user.CurrentUserMiddleware',
        'cms.middleware.page.CurrentPageMiddleware',
        'cms.middleware.toolbar.ToolbarMiddleware',
        'cms.middleware.language.LanguageCookieMiddleware'
    )
    
    INSTALLED_APPS = (
        'djangocms_admin_style',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.admin',
        'django.contrib.sites',
        'django.contrib.sitemaps',
        'django.contrib.staticfiles',
        'django.contrib.messages',
        'cms',
        'menus',
        'sekizai',
        'treebeard',
        'djangocms_text_ckeditor',
        'djangocms_style',
        'djangocms_column',
        'filer',
        'easy_thumbnails',
        'cmsplugin_filer_image',
        'cmsplugin_filer_file',
        'cmsplugin_filer_folder',
        'cmsplugin_filer_teaser',
        'cmsplugin_filer_utils',
        'cmsplugin_filer_video',
        'djangocms_googlemap',
        'djangocms_inherit',
        'djangocms_link',
        'reversion',
        'mysite'
    )
    
    LANGUAGES = (
        ## Customize this
        ('de', gettext('de')),
    )
    
    CMS_LANGUAGES = {
        ## Customize this
        '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,
            },
        ],
    }
    
    CMS_TEMPLATES = (
        ## Customize this
        ('fullwidth.html', 'Fullwidth'),
        ('sidebar_left.html', 'Sidebar Left'),
        ('sidebar_right.html', 'Sidebar Right')
    )
    
    CMS_PERMISSION = True
    
    CMS_PLACEHOLDER_CONF = {}
    
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'HOST': 'localhost',
            'NAME': 'project.db',
            'PASSWORD': '',
            'PORT': '',
            'USER': ''
        }
    }
    
    MIGRATION_MODULES = {
        'cmsplugin_filer_image': 'cmsplugin_filer_image.migrations_django',
        'cmsplugin_filer_file': 'cmsplugin_filer_file.migrations_django',
        'cmsplugin_filer_folder': 'cmsplugin_filer_folder.migrations_django',
        'cmsplugin_filer_video': 'cmsplugin_filer_video.migrations_django',
        'cmsplugin_filer_teaser': 'cmsplugin_filer_teaser.migrations_django'
    }
    
    THUMBNAIL_PROCESSORS = (
        'easy_thumbnails.processors.colorspace',
        'easy_thumbnails.processors.autocrop',
        'filer.thumbnail_processors.scale_and_crop_with_subject_location',
        'easy_thumbnails.processors.filters'
    )
    FinalAngel commented 8 years ago

    @kartikdanidhariya did this solve your issue?