سؤال

I have a django project with few apps. The project is running successfully without any error. Now I am writing test cases for some of the apps in the project.

I ran the test using following command

 python manage.py test apps.UserProfile
هل كانت مفيدة؟

المحلول

You have a circular import. Your stack trace shows Student depends on Student through a bunch of other modules.

Usually you can solve this by changing your import statement to not have a "from"

Eg import apps.x.y.z

This form of import doesn't actually execute the imported module when it hits that statement, so it doesn't get stuck in a circular import loop.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top