What is circular imports?
http://stackabuse.com/python-circular-imports/
You could use python -vv
to inspect import relations.
$ python -vv manage.py shell
>>> from api.models import Application
>>> from member.views.site import signup
or
$ python -vv
>>> import os
>>> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'streetvoice.settings')
>>> import django
>>> django.setup()
>>> from api.models import Application
ref:
https://stackoverflow.com/questions/6351805/cyclic-module-dependencies-and-relative-imports-in-python
https://stackoverflow.com/questions/9098787/tool-for-pinpointing-circular-imports-in-python-django
Python 3.7 has new feature to show time for importing modules. This feature is enabled with -X importtime
option or PYTHONPROFILEIMPORTTIME=1
environment variable.
$ python3.7 -X importtime -c "import pipenv"
ref:
https://dev.to/methane/how-to-speed-up-python-application-startup-time-nkf