At the last step when I run migrate the application crashes with the following stack trace (Same error with makemigrations and runserver):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/MyUser/Programming/my-project/manage.py", line 21, in main
execute_from_command_line(sys.argv)
File "/Users/MyUser/Programming/my-project/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/Users/MyUser/Programming/my-project/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
django.setup()
File "/Users/MyUser/Programming/my-project/.venv/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/MyUser/Programming/my-project/.venv/lib/python3.12/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/MyUser/Programming/my-project/.venv/lib/python3.12/site-packages/django/apps/config.py", line 193, in create
import_module(entry)
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'oauth2_providerapi'
Fixed by changing the order in the Django INSTALLED_APPS. I have put the oauth2_provider first after the django apps, but before all other 3rd party apps, and now it works fine.
Describe the bug I am currently migrating a large enterprise django application to OAuth2.0 with PKCE.
To Reproduce Due to the confidentially agreement I cannot provide the source code, but I can test any recommendations from you.
makemigrations
andrunserver
):I am using the following package versions:
I also tried with Python 3.9 and django 3.2 and got the same issue.
Expected behavior Application should migrate, start, ... (not crash)
Version 2.3.0
Additional context I am developing on a MacBook Pro M3 (Apple Silicon, ARM)