Wagtail CMS 中 运行 服务器出错
Error while running server in Wagtail CMS
当我添加横幅标题时会发生此错误。我认为横幅标题是 class 中的 属性 并且它被引用为字符串。对 DJANGO 和 Wagtail CMS 是全新的 + 在过去的八个月里只有 coding/programming!非常感谢任何帮助(:
这是我的终端显示的内容
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute
autoreload.check_errors(django.setup)()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 855, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 8, in <module>
class HomePage(Page):
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 12, in HomePage
banner_title = models.Charfield(max_length=100, blank=False, null=True)
AttributeError: module 'django.db.models' has no attribute 'Charfield'
^C%
❯ python3 manage.py makemigrations
Traceback (most recent call last):
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 855, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 8, in <module>
class HomePage(Page):
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 12, in HomePage
banner_title = models.Charfield(max_length=100, blank=False, null=True)
Manage.py
from django.db import models
from wagtail.core.models import Page
from wagtail.admin.edit_handlers import FieldPanel
class HomePage(Page):
###Home page model###
templates = "home/home_page.html"
banner_title = models.Charfield(max_length=100, blank=False, null=True)
content_panels = Page.content_panels + [
FieldPanel("banner_title")
]
Charfield
需要大写 F - CharField
.
当我添加横幅标题时会发生此错误。我认为横幅标题是 class 中的 属性 并且它被引用为字符串。对 DJANGO 和 Wagtail CMS 是全新的 + 在过去的八个月里只有 coding/programming!非常感谢任何帮助(:
这是我的终端显示的内容
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute
autoreload.check_errors(django.setup)()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 855, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 8, in <module>
class HomePage(Page):
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 12, in HomePage
banner_title = models.Charfield(max_length=100, blank=False, null=True)
AttributeError: module 'django.db.models' has no attribute 'Charfield'
^C%
❯ python3 manage.py makemigrations
Traceback (most recent call last):
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/alessiolivolsi/.local/share/virtualenvs/wagsite-cck0l_Kh/lib/python3.9/site-packages/django/apps/config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 855, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 8, in <module>
class HomePage(Page):
File "/Users/alessiolivolsi/Work/Projects/first_wag/wagsite/home/models.py", line 12, in HomePage
banner_title = models.Charfield(max_length=100, blank=False, null=True)
Manage.py
from django.db import models
from wagtail.core.models import Page
from wagtail.admin.edit_handlers import FieldPanel
class HomePage(Page):
###Home page model###
templates = "home/home_page.html"
banner_title = models.Charfield(max_length=100, blank=False, null=True)
content_panels = Page.content_panels + [
FieldPanel("banner_title")
]
Charfield
需要大写 F - CharField
.