gautamaggarwal
gautamaggarwal

Reputation: 349

ImportError: No module named 'wagtail.core'

I am using python3 in a virtual environment and have wagtail installed via pip. When I am trying to extend home model for home page. I get the error:- ImportError: No module named 'wagtail.core'

Here is the code of models.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):
    body = RichTextField(blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('body', classname="full"),
    ]

Here is the error stack:-

*Unhandled exception in thread started by <function check_errors
<locals>.wrapper at 0x7f8a45e44400> 

Traceback (most recent call last): 

File "/project/venv/lib/python3.4/site-packages/django/utils/autoreload.py", line 228, in wrapper fn(*args, **kwargs) 

File "/project/venv/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run autoreload.raise_last_exception() 

File "/project/venv/lib/python3.4/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception six.reraise(*_exception) 

File "/project/venv/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise raise value.with_traceback(tb) 

File "/project/venv/lib/python3.4/site-packages/django/utils/autoreload.py", line 228, in wrapper fn(*args, **kwargs) 

File "/project/venv/lib/python3.4/site-packages/django/__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) 

File "/project/venv/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models() 

File "/project/venv/lib/python3.4/site-packages/django/apps/config.py", line 202, in import_models self.models_module = import_module(models_module_name) 

File "/project/venv/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) 

File "<frozen importlib._bootstrap>", line 2254, in _gcd_import 

File "<frozen importlib._bootstrap>", line 2237, in _find_and_load 

File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked 

File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked 

File "<frozen importlib._bootstrap>", line 1129, in _exec 

File "<frozen importlib._bootstrap>", line 1471, in exec_module 

File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed 

File "/project/home/models.py", line 3, in <module> from wagtail.core.models import Page ImportError: No module named 'wagtail.core'*

I am following the basic tutorial for wagtail. Here is the link http://docs.wagtail.io/en/latest/getting_started/tutorial.html

Version of wagtail==1.13.1 and Django==1.11.10. Kindly point to right direction. Thanks in advance.

Upvotes: 2

Views: 10762

Answers (2)

Theophile
Theophile

Reputation: 300

Since wagtail 3.0 :

wagtail.admin.edit_handlers has been replaced by wagtail.admin.panels

and

wagtail.core by wagtail

You can read the 3.0 release for more details

Upvotes: 5

Ashwani Shakya
Ashwani Shakya

Reputation: 439

Edited.

You wrote import statements for wagtail 2.x. Replace import statements with following statements which is for wagtail 1.13.1:

from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel

Kindly follow this link

http://docs.wagtail.io/en/v1.13.1/getting_started/tutorial.html

Upvotes: 4

Related Questions