Problem running Demo

194 views
Skip to first unread message

Ladislav Miženko

unread,
Jan 5, 2016, 4:53:56 AM1/5/16
to Wagtail support
Hi, since I'm new to Wagtail, I want at first take a brief look at features it offers. So I was trying to run the demo without Vagrant.
I followed the steps and everything worked fine. Also when I run server everything looks fine. After couple of minutes playing with demo I've found out that probably some things are missing.

  • There is no Menu on the top of the page, just Homepage icon.
  • When I click on any link (blogpost, people, contact, ...) I got 404
  • There are no pages in the admin, just blank hierarchy 
  • I got this error when I try to create new page

AttributeError at /admin/pages/add/demo/personpage/20/'NoneType' object has no attribute '_inc_path'

Request Method: POST
Request URL: http://192.168.1.105:8000/admin/pages/add/demo/personpage/20/
Django Version: 1.8.2
Exception Type: AttributeError
Exception Value: 'NoneType' object has no attribute '_inc_path'

Exception Location: /home/lako/projects/croptek/wagtaildemo/.wagtaildemo/local/lib/python2.7/site-packages/treebeard/mp_tree.py in process, line 359
Python Executable: /home/lako/projects/croptek/wagtaildemo/.wagtaildemo/bin/python
Python Version: 2.7.10
Python Path: ['/home/lako/projects/croptek/wagtaildemo',
 
'/home/lako/projects/croptek/wagtaildemo/.wagtaildemo/lib/python2.7',
 
'/home/lako/projects/croptek/wagtaildemo/.wagtaildemo/lib/python2.7/plat-x86_64-linux-gnu',
 
'/home/lako/projects/croptek/wagtaildemo/.wagtaildemo/lib/python2.7/lib-tk',
 
'/home/lako/projects/croptek/wagtaildemo/.wagtaildemo/lib/python2.7/lib-old',
 
'/home/lako/projects/croptek/wagtaildemo/.wagtaildemo/lib/python2.7/lib-dynload',
 
'/usr/lib/python2.7',
 
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
 
'/usr/lib/python2.7/lib-tk',
 
'/home/lako/projects/croptek/wagtaildemo/.wagtaildemo/local/lib/python2.7/site-packages']

Server time: Tue, 5 Jan 2016 09:28:10 +0000

Somewhere I found that ./manage.py fixtree helps to fix this error. On vanilla demo when I run this command I got this:

Incorrect numchild value found for pages: [1, 2, 4, 5, 6, 21, 20]

I'm also attaching screens of demo, how it looks on my computer.

Thanks.
Clipboard01.jpg
Clipboard02.jpg

Matthew Westcott

unread,
Jan 5, 2016, 7:36:38 AM1/5/16
to wag...@googlegroups.com
Hi Ladislav,
It sounds like something failed part-way through loading the demo data into the database. Can you try again from a fresh database, and check whether any error messages appear during the `./manage.py migrate` or `./manage.py load_initial_data` steps?

Cheers,
- Matt

Ladislav Miženko

unread,
Jan 5, 2016, 8:01:45 AM1/5/16
to Wagtail support
Hi Matthew, 

thanks for the answer. I've deleted project directory, dropped database and started from the scratch, but it didn't help.

Migration finished with no error, although when I try fixtree I still get errors:

(.wagtaildemo)lako@lako-VirtualBox:~/projects/wagtaildemo$ ./manage.py fixtree
Incorrect numchild value found for pages: [1, 2, 4, 5, 6, 21, 20]
Remaining problems (cannot fix automatically):

Incorrect numchild value found for pages: [1, 2, 4, 5, 6, 21, 20]

Here is migration process for completness:

./manage.py migrate
Operations to perform:
 
Synchronize unmigrated apps: wagtailsites, staticfiles, modelcluster, messages, compressor, wagtailsnippets, rest_framework, wagtailapi
 
Apply all migrations: wagtailusers, wagtailembeds, wagtailadmin, sessions, admin, demo, wagtailcore, auth, wagtailsearchpromotions, contenttypes, wagtaildocs, taggit, wagtailsearch, wagtailforms, wagtailredirects, wagtailimages
Synchronizing apps without migrations:
 
Creating tables...
   
Running deferred SQL...
 
Installing custom SQL...
Running migrations:
 
Rendering model states... DONE
 
Applying contenttypes.0001_initial... OK
 
Applying auth.0001_initial... OK
 
Applying admin.0001_initial... OK
 
Applying contenttypes.0002_remove_content_type_name... OK
 
Applying auth.0002_alter_permission_name_max_length... OK
 
Applying auth.0003_alter_user_email_max_length... OK
 
Applying auth.0004_alter_user_username_opts... OK
 
Applying auth.0005_alter_user_last_login_null... OK
 
Applying auth.0006_require_contenttypes_0002... OK
 
Applying taggit.0001_initial... OK
 
Applying taggit.0002_auto_20150616_2121... OK
 
Applying wagtailimages.0001_initial... OK
 
Applying wagtailcore.0001_squashed_0016_change_page_url_path_to_text_field... OK
 
Applying wagtailimages.0002_initial_data... OK
 
Applying wagtaildocs.0001_initial... OK
 
Applying wagtaildocs.0002_initial_data... OK
 
Applying demo.0001_initial... OK
 
Applying demo.0002_auto_20150917_1037... OK
 
Applying demo.0003_auto_20150917_1200... OK
 
Applying demo.0004_auto_20151019_1351... OK
 
Applying sessions.0001_initial... OK
 
Applying wagtailadmin.0001_create_admin_access_permissions... OK
 
Applying wagtailcore.0017_change_edit_page_permission_description... OK
 
Applying wagtailcore.0018_pagerevision_submitted_for_moderation_index... OK
 
Applying wagtailcore.0019_verbose_names_cleanup... OK
 
Applying wagtailcore.0020_add_index_on_page_first_published_at... OK
 
Applying wagtailcore.0021_capitalizeverbose... OK
 
Applying wagtailcore.0022_add_site_name... OK
 
Applying wagtailcore.0023_alter_page_revision_on_delete_behaviour... OK
 
Applying wagtaildocs.0003_add_verbose_names... OK
 
Applying wagtaildocs.0004_capitalizeverbose... OK
 
Applying wagtailembeds.0001_initial... OK
 
Applying wagtailembeds.0002_add_verbose_names... OK
 
Applying wagtailembeds.0003_capitalizeverbose... OK
 
Applying wagtailforms.0001_initial... OK
 
Applying wagtailforms.0002_add_verbose_names... OK
 
Applying wagtailforms.0003_capitalizeverbose... OK
 
Applying wagtailimages.0003_fix_focal_point_fields... OK
 
Applying wagtailimages.0004_make_focal_point_key_not_nullable... OK
 
Applying wagtailimages.0005_make_filter_spec_unique... OK
 
Applying wagtailimages.0006_add_verbose_names... OK
 
Applying wagtailimages.0007_image_file_size... OK
 
Applying wagtailimages.0008_image_created_at_index... OK
 
Applying wagtailimages.0009_capitalizeverbose... OK
 
Applying wagtailimages.0010_change_on_delete_behaviour... OK
 
Applying wagtailredirects.0001_initial... OK
 
Applying wagtailredirects.0002_add_verbose_names... OK
 
Applying wagtailredirects.0003_make_site_field_editable... OK
 
Applying wagtailredirects.0004_set_unique_on_path_and_site... OK
 
Applying wagtailredirects.0005_capitalizeverbose... OK
 
Applying wagtailsearch.0001_initial... OK
 
Applying wagtailsearch.0002_add_verbose_names... OK
 
Applying wagtailsearch.0003_remove_editors_pick... OK
 
Applying wagtailsearchpromotions.0001_initial... OK
 
Applying wagtailsearchpromotions.0002_capitalizeverbose... OK
 
Applying wagtailusers.0001_initial... OK
 
Applying wagtailusers.0002_add_verbose_name_on_userprofile... OK
 
Applying wagtailusers.0003_add_verbose_names... OK
 
Applying wagtailusers.0004_capitalizeverbose... OK

Ladislav Miženko

unread,
Jan 5, 2016, 8:50:39 AM1/5/16
to Wagtail support
Update:

I've found out that when I switch from PostgreSQL to SQLite, everything works fine. But I don't get any errors when installing with PostgreSQL. Any tips what is wrong?

Matthew Westcott

unread,
Jan 7, 2016, 5:31:50 AM1/7/16
to wag...@googlegroups.com
Please can you make a dump of the Postgres database ( pg_dump wagtaildemo -f wagtaildemo.sql ) after running ./manage.py migrate and ./manage.py load_initial_data, and upload the wagtaildemo.sql file somewhere for me to look at (or email it to me directly)? That'll help me work out exactly where the import has failed.

Cheers,
- Matt

Ladislav Miženko

unread,
Jan 7, 2016, 6:54:20 AM1/7/16
to Wagtail support
Hi, I've uploaded dump file here: http://pastebin.com/zt12sWdM

Thanks for help.

Matthew Westcott

unread,
Jan 7, 2016, 7:22:43 AM1/7/16
to wag...@googlegroups.com
Thanks - so, with this copy of the database, `./manage.py fixtree` is *definitely* failing as described? This looks like an entirely correct copy of the wagtaildemo data to me - and when I import and run it on my machine, everything works perfectly (./manage.py fixtree returns no errors, and adding a new page works fine). Very mysterious!

- Matt
> --
> You received this message because you are subscribed to the Google Groups "Wagtail support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wagtail+u...@googlegroups.com.
> To post to this group, send email to wag...@googlegroups.com.
> Visit this group at https://groups.google.com/group/wagtail.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/wagtail/72542d0c-5624-4392-be98-11bdb3bf728a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ladislav Miženko

unread,
Jan 7, 2016, 8:49:35 AM1/7/16
to Wagtail support
Yes I didn't alter anything. I've recorded whole process of installing the demo to be sure the I'm not doing anything wrong: https://youtu.be/iNwiLW2teSc
Postgres version is 9.4.5

Matthew Westcott

unread,
Jan 7, 2016, 9:27:16 AM1/7/16
to wag...@googlegroups.com
Please could you try running the following lines in the Django Python shell ( ./manage.py shell ):

from wagtail.wagtailcore.models import Page
for p in Page.objects.order_by('path'):
print([p.id, p.path, p.depth, p.numchild, p.is_leaf(), [child.id for child in p.get_children()]])


and let me know the output?

- Matt
> To view this discussion on the web, visit https://groups.google.com/d/msgid/wagtail/7ca04757-44ae-4cdd-b621-79eece1cd20a%40googlegroups.com.

Ladislav Miženko

unread,
Jan 7, 2016, 9:31:31 AM1/7/16
to Wagtail support
This is the output

[1, u'0001', 1, 1, False, []]
[2, u'00010002', 2, 5, False, []]
[4, u'000100020001', 3, 2, False, []]
[8, u'0001000200010001', 4, 0, True, []]
[9, u'0001000200010002', 4, 0, True, []]
[5, u'000100020002', 3, 3, False, []]
[16, u'0001000200020001', 4, 0, True, []]
[18, u'0001000200020002', 4, 0, True, []]
[19, u'0001000200020003', 4, 0, True, []]
[6, u'000100020003', 3, 4, False, []]
[10, u'0001000200030001', 4, 0, True, []]
[15, u'0001000200030002', 4, 0, True, []]
[17, u'0001000200030007', 4, 0, True, []]
[21, u'0001000200030008', 4, 2, False, []]
[22, u'00010002000300080001', 5, 0, True, []]
[23, u'00010002000300080002', 5, 0, True, []]
[20, u'000100020004', 3, 2, False, []]
[13, u'0001000200040001', 4, 0, True, []]
[14, u'0001000200040002', 4, 0, True, []]
[12, u'000100020005', 3, 0, True, []]

Matthew Westcott

unread,
Jan 7, 2016, 10:02:02 AM1/7/16
to wag...@googlegroups.com
OK, still not sure what's going on there, but I think we're getting closer :-) Next thing to try, please (within ./manage.py shell again):

from wagtail.wagtailcore.models import Page
for p in Page.objects.order_by('path'):
interval = p._get_children_path_interval(p.path)
print([p.id, p.path, interval, [desc.id for desc in Page.objects.filter(path__range=interval)]])


- Matt

Ladislav Miženko

unread,
Jan 8, 2016, 4:23:42 AM1/8/16
to Wagtail support
Here is the output:

[1, u'0001', (u'00010000', u'0001ZZZZ'), []]
[2, u'00010002', (u'000100020000', u'00010002ZZZZ'), []]
[4, u'000100020001', (u'0001000200010000', u'000100020001ZZZZ'), []]
[8, u'0001000200010001', (u'00010002000100010000', u'0001000200010001ZZZZ'), []]
[9, u'0001000200010002', (u'00010002000100020000', u'0001000200010002ZZZZ'), []]
[5, u'000100020002', (u'0001000200020000', u'000100020002ZZZZ'), []]
[16, u'0001000200020001', (u'00010002000200010000', u'0001000200020001ZZZZ'), []]
[18, u'0001000200020002', (u'00010002000200020000', u'0001000200020002ZZZZ'), []]
[19, u'0001000200020003', (u'00010002000200030000', u'0001000200020003ZZZZ'), []]
[6, u'000100020003', (u'0001000200030000', u'000100020003ZZZZ'), []]
[10, u'0001000200030001', (u'00010002000300010000', u'0001000200030001ZZZZ'), []]
[15, u'0001000200030002', (u'00010002000300020000', u'0001000200030002ZZZZ'), []]
[17, u'0001000200030007', (u'00010002000300070000', u'0001000200030007ZZZZ'), []]
[21, u'0001000200030008', (u'00010002000300080000', u'0001000200030008ZZZZ'), []]
[22, u'00010002000300080001', (u'000100020003000800010000', u'00010002000300080001ZZZZ'), []]
[23, u'00010002000300080002', (u'000100020003000800020000', u'00010002000300080002ZZZZ'), []]
[20, u'000100020004', (u'0001000200040000', u'000100020004ZZZZ'), []]
[13, u'0001000200040001', (u'00010002000400010000', u'0001000200040001ZZZZ'), []]
[14, u'0001000200040002', (u'00010002000400020000', u'0001000200040002ZZZZ'), []]
[12, u'000100020005', (u'0001000200050000', u'000100020005ZZZZ'), []]

Matthew Westcott

unread,
Jan 8, 2016, 6:58:28 AM1/8/16
to wag...@googlegroups.com
Thanks! I can make a good guess at what's causing this now: I suspect your Postgres database is configured with some uncommon locale / collation settings. If you run
psql -l
does the entry for wagtaildemo show something other than "en_US.UTF-8" in the Collate / Ctype columns? If so, try recreating the database with this command:
createdb wagtaildemo --locale=en_US.UTF-8
This might fail with an error like "new collation (en_US.UTF-8) is incompatible with the collation of the template database" - if so, use this instead:
createdb wagtaildemo --locale=en_US.UTF-8 --template=template0


Some extra background: these strings like '000100020001' are used by Wagtail (and more exactly, the django-treebeard library) to represent the page tree structure. To find all the descendants of a page, we run a query like "find all paths greater than 0001000200010000 and less than 000100020001ZZZZ". I would expect this to return 0001000200010001 and 0001000200010002, but these comparisons are apparently failing on your database. I'm guessing you're probably using a Czech locale (this guess is mainly based on your video of the robot dancing to Ivan Mladek in the YouTube sidebar, which caught my eye :-) ), and I've found some references to suggest that Czech ordering rules place numbers *after* letters:
http://www.postgresql.org/message-id/1236341350.1404.30.camel@localhost
http://prirucka.ujc.cas.cz/?id=900
It seems that this doesn't always happen (I haven't been able to replicate the bug by setting my database to cs_CZ or cs_CZ.UTF-8), but it's definitely worth a try.

Cheers,
- Matt

Ladislav Miženko

unread,
Jan 11, 2016, 4:10:01 AM1/11/16
to Wagtail support
Yes thank you, this solved the problem! 
Good point there about czech locales, you were almost right (I had sk_SK collation) :)

Matthew Westcott

unread,
Jan 12, 2016, 1:13:49 PM1/12/16
to wag...@googlegroups.com
Good to know - thanks for helping to track this down! I've now put together a fix for the next release, which should hopefully stop this from happening on sk_SK locale databases:
https://github.com/torchbox/wagtail/pull/2107

Cheers,
- Matt
Reply all
Reply to author
Forward
0 new messages