Tutorial :Stand alone Django app for OS X


For school, I have made a CMS in django for my major assessment task for Software. My teacher has asked to get the source code and, if applicable, the program compiled.

Now, because i dont want my teacher to install django (Something might go wrong, he may get a different version, missing dependences), how can i package up my django app, plus the django source and make the whole thing runnable (on the development server) by running a single script?

He has python, so that does not need to be included and the target OS would be OS X, but Windows can do as well.


Pip and VirtualENV will make this task much easier. (not sure the support for windows though)

PIP will help with the requirements installation. http://pypi.python.org/pypi/pip

VirtualENV provides an isolated python environment. URL: http://pypi.python.org/pypi/virtualenv

Reading through this blog post on installing Pinax will give you a good understanding on how the two work together: http://uswaretech.com/blog/2009/03/create-a-new-social-networking-site-in-few-hours-using-pinax-platform-django/


Perhaps Instant Django will set you in the right direction. It's for windows, but it might be of help.


Without having actually tested it, you should be able to copy the main django directory (/usr/lib/python2.6/site-packages/django for me) over into your project directory, and archive the whole thing. This will continue to keep everything importable (from django import ...), and make it so there's just one archive to extract.

Now, I wouldn't say this is a good way, but it's simple, and I think it'll work. I think.


I belive this is what your looking for (it's not pretty but it gets the job done). It describes how to package django, a web server, and everything else needed to make a stand alone django application. To make it work for osx you should just be able to substitue py2app (http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html) instead of py2exe and it should (cross your fingers) work, however I have not tested it. Hope this helps!

Ps: sorry for not hyperlinking py2app im a new user and cant post 2 links yet :(

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »