5

I started this Turial, Here

And get this error

**mongoengine.errors.NotRegistered:** `Comment` has not been registered in the document registry. Importing the document class automatically registers it, has it been imported?

any idea. Thank you So much.

juvasquezg
  • 117
  • 2
  • 11

2 Answers2

3

Just place the Comment Model above the Post Model, since the Comment Model is being referenced in the Post Model

i_emmanuel
  • 519
  • 6
  • 6
3

First register all your models some where like __init__.py file in your models package.

Then you can use get_document('Comment') function (which is imported from mongoengine.base.common) instead of importing your models in each other scripts to avoid circular imports and exceptions like mongoengine.errors.NotRegistered

hamidfzm
  • 4,595
  • 8
  • 48
  • 80