|Version 3 (modified by perica.zivkovic@…, 8 years ago) (diff)|
Django On a Stick
As a little experiment in ducking corporate build policies I've installed Django on my USB stick. It's a 2Gb monster so I haven't really been too careful about file sizes etc. It's weighing in at about 100 Mb but that includes the following:
- Python 2.5
- Apache with mod_python
- Load of unix tools (including Subversion)
It's fairly simple to do yourself but there were a few gottchas. This is all done for Windows btw.
Firstly install Python. Just point the installer at the USB stick and let it do it's stuff. It'll put a load of stuff in the registry but things will work elsewhere as well. (If you've got Python installed on your system the the installer won't work. You can just copy across your python25 directory and give that a go).
Install all your Python extras such as PIL. The installers for these will pick up the stick installation and put their magic where needed.
Install Apache. Just point the installer at the stick.
Install an appropriate mod_python from here. Point it at the stick and the Apache installation. Add the following line to the httpd.conf in the Apache 'conf' directory:
LoadModule python_module modules/mod_python.so
Download and install Subversion from here.
Create a directory for the source code. You can put this in your site-packages directory but I created a separate place to put it 'just in case'.
Install the latest trunk:
svn co http://code.djangoproject.com/svn/django/trunk/ your_new_directory
Add the directory to your sys.path. Create a 'python.pth' file in your python25 directory and add the path to your Django source. Mine looks like this:
Create a setup.bat on the stick and change the following to point at your paths.
set PYTHONHOME=\path_to\python25 set PATH=%PATH%;\path_to\python25;\path_to\svn\bin;\path_to\django_src\django\bin;\path_to\apache\bin
Try running httpd -t and see whether your httpd.conf is valid. If it is then you're done! Follow the mod_python installation instructions and set yourself up a new project.
NOTE: No database has been installed but Python 2.5 comes with sqlite3 so configure your Django project to use it.
- Had a problem after installing ipython; complaints were made about a missing DLL. Copy across pywintypes25.dll from windows\system32 (stick it in the DLL directory under the python installation) and give it a go.
- PortablePython.com Portable Python distribution (with django preinstalled)