Я новичок в трясогузке и следую как официальным, так и учебным пособиям по YouTube (все-таки пропускаются инструкции по установке libjpeg и zlib, но когда я пытался, там говорится, что они включены в Pillow); Работает на windows10, используя последнюю python, последнюю трясогузку, последнюю версию django; Застрял на первом месте, все еще получая ту же проблему при запуске makemigrations или migrate или runserver:
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\home\models.py", line 14, in
HomePage
banner_subtitle = models.RichTextField(features=["bold", "italic"])
AttributeError: module 'django.db.models' has no attribute 'RichTextField'
вот мои модели.py:
from django.db import models
from wagtail.core.models import Page
from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
class HomePage(Page):
"""Homepage model."""
body = RichTextField(blank=True)
templates = "templates/home/home_page.html"
max_count = 1
banner_title = models.CharField('Body', blank=True)
banner_subtitle = models.RichTextField(features=["bold", "italic"])
banner_image = models.ForeignKey(features=
"wagtailImages.Image",
null=False,
blank=False,
on_delete=models.SET_NULL,
related_name="+"
)
banner_cta = models.ForeignKey(
"wagtailcore.Page",
)
content_panels = Page.content_panels + [
FieldPanel("banner_title"),
]
class Meta:
verbose_name = "HomePage"
verbose_name_plural = "HomePages"
И вот полный возвратный след:
Traceback (most recent call last):
File ".\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\venv_bloggyblog\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\venv_bloggyblog\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\venv_bloggyblog\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\venv_bloggyblog\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\venv_bloggyblog\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Program Files\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\home\models.py", line 7, in <module>
class HomePage(Page):
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\home\models.py", line 14, in
HomePage
banner_subtitle = models.RichTextField(features=["bold", "italic"])
AttributeError: module 'django.db.models' has no attribute 'RichTextField'
А вот что происходит, когда я запускаю wagtail updatemodulepaths:
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\TalkyWalky\Desktop\Workspace\bloggyblog\venv_bloggyblog\Scripts\wagtail.exe\__main__.py", line 7, in <module>
File "c:\users\talkywalky\desktop\workspace\bloggyblog\venv_bloggyblog\lib\site-packages\wagtail\bin\wagtail.py", line 297, in main
command.execute(sys.argv)
File "c:\users\talkywalky\desktop\workspace\bloggyblog\venv_bloggyblog\lib\site-packages\wagtail\bin\wagtail.py", line 52, in execute
self.run(**options_dict)
File "c:\users\talkywalky\desktop\workspace\bloggyblog\venv_bloggyblog\lib\site-packages\wagtail\bin\wagtail.py", line 171, in run
change_count = self._rewrite_file(path)
File "c:\users\talkywalky\desktop\workspace\bloggyblog\venv_bloggyblog\lib\site-packages\wagtail\bin\wagtail.py", line 236, in _rewrite_file
for original_line in f:
File "C:\Program Files\Python38\lib\fileinput.py", line 248, in __next__
line = self._readline()
File "C:\Program Files\Python38\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 641: character
maps to <undefined>