Reputation: 511
I made a Django react app. Now I want to make it a desktop application so that the user does not have type python manage.py runserver
and also activate the environment every time. I used pyinstaller. I did all the steps mentioned for django.
when I run my executable file made from pyinstaller, I got this error
File "manage.py", line 5, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
File "djoser\__init__.py", line 6, in <module>
File "importlib\metadata\__init__.py", line 955, in version
File "importlib\metadata\__init__.py", line 928, in distribution
File "importlib\metadata\__init__.py", line 518, in from_name
importlib.metadata.PackageNotFoundError: No package metadata was found for djoser
[2200] Failed to execute script 'manage' due to unhandled exception!
I have already installed Djoser in the environment and the environment is also activated. I have also tried to add in manage.py file and also in hidden_import lists but nothing changed. I have also tried adding --copy-meta=djoser
in the build command but it got even worse error.
How do I fix this error and If there are any better alternative solutions out there? Thanks
Upvotes: -1
Views: 1340
Reputation: 511
Well I have found for myself another solution . To run this django file by creating a batch file
@echo off
set "VENV_NAME=myenv"
set "PROJECT_DIR=C:\path\to\project"
cd /d %~dp0
cd /d %PROJECT_DIR%
call "%VENV_NAME%\Scripts\activate.bat"
python manage.py runserver
Upvotes: 0