python 尝试在Django管理后台管理页面时出现TemplateSyntaxError

ecbunoof  于 2022-11-21  发布在  Python
关注(0)|答案(1)|浏览(183)

我是新的Django CMS和我有经验的错误时,试图添加一个页面或页面类型通过后端网站。下面是我得到的错误。
我使用的是Django 4.1.1版本,Django-cms 3.11.0.
如有任何帮助或建议,我们将不胜感激。

TemplateSyntaxError at /admin/cms/pagetype/add/
Invalid block tag on line 101: 'page_submit_row', expected 'endif'. Did you forget to register or load this tag?
Request Method: GET
Request URL:    http://localhost:8000/admin/cms/pagetype/add/
Django Version: 4.1.1
Exception Type: TemplateSyntaxError
Exception Value:    
Invalid block tag on line 101: 'page_submit_row', expected 'endif'. Did you forget to register or load this tag?
Exception Location: C:\project_data\python\myblog\env\lib\site-packages\django\template\base.py, line 557, in invalid_block_tag
Raised during:  cms.admin.pageadmin.add_view
Python Executable:  C:\project_data\python\myblog\env\Scripts\python.exe
Python Version: 3.10.7
Python Path:    
['C:\\project_data\\python\\myblog\\myblog',
 'C:\\Program '
 'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\\python310.zip',
 'C:\\Program '
 'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\\DLLs',
 'C:\\Program '
 'Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\\lib',
 'C:\\Users\\Rosidin\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0',
 'C:\\project_data\\python\\myblog\\env',
 'C:\\project_data\\python\\myblog\\

这是我的settings.py

安全警告:对生产中使用的密钥保密!

SECRET_KEY = 'django-insecure-rt-cu)&d604(@1pmfi!@z^_etwo(jvm!k#&z3&yxb62ll+gz1#'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
X_FRAME_OPTIONS = 'SAMEORIGIN'
SITE_ID = 1

# Application definition

INSTALLED_APPS = [
    'djangocms_admin_style',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'simpleblog',
    'sekizai',
    'django.contrib.sites',
    'cms',
    'menus',
    'treebeard',
]

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',
    'cms.middleware.user.CurrentUserMiddleware',
    'cms.middleware.page.CurrentPageMiddleware',
    'cms.middleware.toolbar.ToolbarMiddleware',
    'cms.middleware.language.LanguageCookieMiddleware',
    'cms.middleware.utils.ApphookReloadMiddleware',
    'django.middleware.locale.LocaleMiddleware',
]

ROOT_URLCONF = 'myblog.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',
                'sekizai.context_processors.sekizai',
                'cms.context_processors.cms_settings',
                'django.template.context_processors.i18n',
            ],
        },
    },
]

WSGI_APPLICATION = 'myblog.wsgi.application'

# Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'myblog',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '3306',
    }
}

# Password validation

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

LANGUAGE_CODE = 'en'
LANGUAGES = [
    ('en', 'English'),
    ('de', 'German'),
]

TIME_ZONE = 'UTC'

USE_I18N = False

USE_TZ = True

# Static files (CSS, JavaScript, Images)

STATIC_URL = 'static/'

# Default primary key field type

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

运行命令cms check后,我得到了错误

Traceback (most recent call last):
  File "C:\project_data\python\myblog\myblog\manage.py", line 22, in <module> main()
  File "C:\project_data\python\myblog\myblog\manage.py", line 18, in main execute_from_command_line(sys.argv)
  File "C:\project_data\python\myblog\env\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\project_data\python\myblog\env\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\project_data\python\myblog\env\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\project_data\python\myblog\env\lib\site-packages\django\core\management\base.py", line 441, in execute
    if self.requires_system_checks and not options["skip_checks"]:
KeyError: 'skip_checks'
xeufq47z

xeufq47z1#

Django CMS 3.11.0还不支持Django 4.1。请降级到Django 4.0(或LTS 3.2)。

相关问题