OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

pyinstaller django :modules not found

  • Thread starter Thread starter ahmed tahri
  • Start date Start date
A

ahmed tahri

Guest
i have turned my django application into exe file and i cant runserver , because some modules are not found
django version 3.2.25
pyinstaller 5.12

at firrst runserver didnt work also so i used --noreload then it showed me another error about rest_framework

Code:
C:\Users\GAMING\Documents\pythonexe1\project\dist>manage runserver --noreload
Performing system checks...

Traceback (most recent call last):
  File "rest_framework\settings.py", line 179, in import_from_string
  File "django\utils\module_loading.py", line 17, in import_string
  File "importlib\__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rest_framework.authentication'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 19, in <module>
  File "manage.py", line 16, in main
  File "django\core\management\__init__.py", line 419, in execute_from_command_line
  File "django\core\management\__init__.py", line 413, in execute
  File "django\core\management\base.py", line 354, in run_from_argv
  File "django\core\management\commands\runserver.py", line 61, in execute
  File "django\core\management\base.py", line 398, in execute
  File "django\core\management\commands\runserver.py", line 96, in handle
  File "django\core\management\commands\runserver.py", line 105, in run
  File "django\core\management\commands\runserver.py", line 118, in inner_run
  File "django\core\management\base.py", line 423, in check
  File "django\core\checks\registry.py", line 76, in run_checks
  File "django\core\checks\urls.py", line 13, in check_url_config
  File "django\core\checks\urls.py", line 23, in check_resolver
  File "django\urls\resolvers.py", line 416, in check
  File "django\utils\functional.py", line 48, in __get__
  File "django\urls\resolvers.py", line 602, in url_patterns
  File "django\utils\functional.py", line 48, in __get__
  File "django\urls\resolvers.py", line 595, in urlconf_module
  File "importlib\__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "project\urls.py", line 18, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "mqtt_app\urls.py", line 2, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "mqtt_app\views.py", line 5, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "rest_framework\views.py", line 17, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "rest_framework\schemas\__init__.py", line 33, in <module>
  File "rest_framework\settings.py", line 227, in __getattr__
  File "rest_framework\settings.py", line 170, in perform_import
  File "rest_framework\settings.py", line 170, in <listcomp>
  File "rest_framework\settings.py", line 182, in import_from_string
ImportError: Could not import 'rest_framework.authentication.SessionAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ModuleNotFoundError: No module named 'rest_framework.authentication'.
[41700] Failed to execute script 'manage' due to unhandled exception!
<p>i have turned my django application into exe file and i cant runserver , because some modules are not found<br />
django version 3.2.25<br />
pyinstaller 5.12</p>
<p>at firrst runserver didnt work also so i used <strong>--noreload</strong> then it showed me another error about rest_framework</p>
<pre><code>C:\Users\GAMING\Documents\pythonexe1\project\dist>manage runserver --noreload
Performing system checks...

Traceback (most recent call last):
File "rest_framework\settings.py", line 179, in import_from_string
File "django\utils\module_loading.py", line 17, in import_string
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rest_framework.authentication'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 19, in <module>
File "manage.py", line 16, in main
File "django\core\management\__init__.py", line 419, in execute_from_command_line
File "django\core\management\__init__.py", line 413, in execute
File "django\core\management\base.py", line 354, in run_from_argv
File "django\core\management\commands\runserver.py", line 61, in execute
File "django\core\management\base.py", line 398, in execute
File "django\core\management\commands\runserver.py", line 96, in handle
File "django\core\management\commands\runserver.py", line 105, in run
File "django\core\management\commands\runserver.py", line 118, in inner_run
File "django\core\management\base.py", line 423, in check
File "django\core\checks\registry.py", line 76, in run_checks
File "django\core\checks\urls.py", line 13, in check_url_config
File "django\core\checks\urls.py", line 23, in check_resolver
File "django\urls\resolvers.py", line 416, in check
File "django\utils\functional.py", line 48, in __get__
File "django\urls\resolvers.py", line 602, in url_patterns
File "django\utils\functional.py", line 48, in __get__
File "django\urls\resolvers.py", line 595, in urlconf_module
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "project\urls.py", line 18, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "mqtt_app\urls.py", line 2, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "mqtt_app\views.py", line 5, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "rest_framework\views.py", line 17, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
File "rest_framework\schemas\__init__.py", line 33, in <module>
File "rest_framework\settings.py", line 227, in __getattr__
File "rest_framework\settings.py", line 170, in perform_import
File "rest_framework\settings.py", line 170, in <listcomp>
File "rest_framework\settings.py", line 182, in import_from_string
ImportError: Could not import 'rest_framework.authentication.SessionAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ModuleNotFoundError: No module named 'rest_framework.authentication'.
[41700] Failed to execute script 'manage' due to unhandled exception!
</code></pre>
 

Latest posts

D
Replies
0
Views
1
Dhanushka Amarakoon
D
S
Replies
0
Views
1
Shikhar Ambashta
S
Top