wobbily_col
wobbily_col

Reputation: 11878

Django Wagtail says I have -1 pages, attribute error when clicking explorer

I am building a jobsite with a blog. I set up Wagtail a while ago and toyed with the basics. I then built the jobsite (as a separate app in the project with Wagtail installed) and that is up and running.

Now (a few months later) I am looking to work on the blog part of the site. When I log into the Wagtail admin, it says I have "-1 pages". When I click on the "explorer" link I get an attribute error:

Traceback:

File "/home/colin/Envs/matchstaff/lib/python3.4/site-packages/django/core/handlers/exception.py" in inner
  42.             response = get_response(request)

File "/home/colin/Envs/matchstaff/lib/python3.4/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/home/colin/Envs/matchstaff/lib/python3.4/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/colin/Envs/matchstaff/lib/python3.4/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/colin/Envs/matchstaff/lib/python3.4/site-packages/django/views/decorators/cache.py" in _cache_controlled
  43.             response = viewfunc(request, *args, **kw)

File "/home/colin/Envs/matchstaff/lib/python3.4/site-packages/wagtail/wagtailadmin/decorators.py" in decorated_view
  24.             return view_func(request, *args, **kwargs)

File "/home/colin/Envs/matchstaff/lib/python3.4/site-packages/wagtail/wagtailadmin/views/pages.py" in index
  43.         parent_page = Page.get_first_root_node().specific

Exception Type: AttributeError at /admin/pages/
Exception Value: 'NoneType' object has no attribute 'specific'

Is this a data error where it is expecting a default page in the database? (I did add some test pages when I initially set up wagtail as proof of concept, though I assume that those got deleted when developing the jobsite part of the application).

Upvotes: 1

Views: 426

Answers (1)

dentemm
dentemm

Reputation: 6379

You can check what pages still exist if you check the regular django admin (path = /django-admin). Most likely there is a page (under wagtailcore/pages) whose content_type is not Page (or a subclass of Page). You can change the content_type right there and you should be fine.

PS: Also check that the root page is of type Page.

Edit: I just realised it could also be that the root page is missing (if you accidentally deleted all pages), and than you should create one. That can also be done in the django admin.

Upvotes: 1

Related Questions