Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling django project as a desktop application

Tags:

python

django

I have a web application that I would like to have a version of it on the desktop. It would be totally awesome if i can just compile it rather than rewrite it. (I can't give the customer the code unfortunately)

I did some research and found some solutions to compile python in general. These solutions are:

  • cx_freeze
  • py2exe
  • pyinstaller (this one claims it has support for django but still unreleased)
  • dbuilder.py

That desktop application will run mainly on Windows, but if I can find a solution that would make it run on Linux and Mac too it would be great.

Did anyone manage to do this properly ? If so, can you please point me to the right direction?

Thanks.

like image 887
thelinuxer Avatar asked Apr 23 '13 14:04

thelinuxer


People also ask

Can you make a desktop app with Django?

Not only JS folks can reuse web tehnologies for desktop applications we can do it too. If you want to create a nice gui and you want to reuse your web tech knowledge try flaskwebgui.

Is it possible to compile Django project?

We have to be able to use the project with apache so it cannot be compiled into a standalone binary. The way I think of it is that it will be compiled into libs and these libs will be exposed to the interpreter so it should behave like the current state of the project with python.


1 Answers

Yes, I am doing this on OSX. It's not simple and, as far as I can tell, I may be the first person to successfully do it on OSX, so YMMV.

Pyinstaller, as of March, wasn't quite ready for Django support. I've filed a few tickets from when I tried to use it to package my application and I have admittedly not fixed those issues yet.

I went with py2app, ultimately, because I had prior experience with it for other applications. I made a sample project with py2app and Django and put it on Github. You may find it useful. I also linked a few of the pages that I found useful in the process, which I've included below:

https://groups.google.com/forum/?fromgroups=#!topic/django-users/-VGqvHew35g

http://misunderstandings.wordpress.com/2008/06/26/django-desktop-app/

https://bitbucket.org/Lawouach/cherrypy-recipes/src/9c35b4b62ef1/frameworks/django_?at=default

If I had to do it again, I would probably use SQLAlchemy and wxPython or PySide. I'd recommend thinking carefully about what you'd like to achieve using Django as a packaged application because it introduces a lot of complexity.

like image 169
Kevin London Avatar answered Oct 19 '22 08:10

Kevin London