I’m late to this post. Thanks for writing this, Ivan Yu
My name is Kimsia and I’m a Django web dev based in Singapore. I came across this by chance via googling.
I’m also interested in building a desktop app (preferably cross platform on Mac, windows, etc) while leveraging on my Django abilities.
Is there a community for like-minded people (like everyone here in this thread) to discuss our various attempts to do this?
After a bit of fiddling around, I got everything to work in Part 2 and I'll share the issues I found and resolved here.
#1: The src/build/afterExtract.js python copy folder function doesn't seem to work.
Update: This is a pathing issue it seems. The source folder should have the additional \edtwExample\ to reach the actual dist folder. Your Github repo adds a parent folder with .bat files which makes the existing path invalid.
#2: I found other pathing issues that make it not work right out of the box.
For example, the edtwExample.spec in the python folder points to edtwExample\manage.py, but the manage.py is in the same folder as the spec file.
#3: The spawn command for production doesn't seem to run properly. I got a number of issues, but the approach I write here in "Edit" works.
Edit: The previous way didn't work all the time. Here is a guaranteed way.
const serverPath = path.join(app.getAppPath(),"..","..","python", "edtwExample.exe")
const command = "${serverPath}" runserver --noreload;
return spawn(command, {
shell: true,
});
You need a stable path to work from. spawn on Node.js is based on the path your command line is calling processes from.
I used app.getAppPath().
Excelent blog and work! I have a question: What about managing a DB using django as the backend? Will be the app able to make actions against the DB?
Thanks for the great piece of work!
Don't you plan to add a production Web-server like nginx or Apache to the project?
It'd be great to have a self-contained and real production environment.
What do you think? Is it possible?
Thanks.
James Sugjin Kahng
Vincent Pawlowski
Developper
Ivan Yu, thank you so much for the post. I did Part 1 with not much trouble... However, on Part 2, I am struggling to package the django app using Pyinstaller... No matter what I try, I get the following error:
PyInstaller.exceptions.PythonLibraryNotFoundError: Python library not found
Even when I want to package a very simple python app in a venv virtual env, I get this error... Any idea why ? Thank you