| 1 | == Django On a Stick == |
| 2 | |
| 3 | 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: |
| 4 | |
| 5 | * Python 2.5 |
| 6 | * Django |
| 7 | * Apache with mod_python |
| 8 | * OpenSSL |
| 9 | * Load of unix tools (including Subversion) |
| 10 | |
| 11 | It's fairly simple to do yourself but there were a few gottchas. This is all done for Windows btw. |
| 12 | |
| 13 | 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). |
| 14 | |
| 15 | Install all your Python extras such as PIL. The installers for these will pick up the stick installation and put their magic where needed. |
| 16 | |
| 17 | Install Apache. Just point the installer at the stick. |
| 18 | |
| 19 | Install an appropriate mod_python [http://nicolas.lehuen.com/download/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: |
| 20 | |
| 21 | {{{ |
| 22 | LoadModule python_module modules/mod_python.so |
| 23 | }}} |
| 24 | |
| 25 | Download and install Subversion [http://subversion.tigris.org/ from here]. |
| 26 | |
| 27 | 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'. |
| 28 | |
| 29 | Install the latest trunk: |
| 30 | |
| 31 | {{{ |
| 32 | svn co http://code.djangoproject.com/svn/django/trunk/ your_new_directory |
| 33 | }}} |
| 34 | |
| 35 | 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: |
| 36 | |
| 37 | {{{ |
| 38 | \Documents\development\django_src |
| 39 | }}} |
| 40 | |
| 41 | Create a setup.bat on the stick and change the following to point at your paths. |
| 42 | |
| 43 | {{{ |
| 44 | set PYTHONHOME=\path_to\python25 |
| 45 | set PATH=%PATH%;\path_to\python25;\path_to\svn\bin;\path_to\django_src\django\bin;\path_to\apache\bin |
| 46 | }}} |
| 47 | |
| 48 | Try running {{{httpd -t}}} and see whether your httpd.conf is valid. If it is then you're done! Follow the mod_python installation [http://www.djangoproject.com/documentation/modpython/ instructions] and set yourself up a new project. |
| 49 | |
| 50 | NOTE: No database has been installed but Python 2.5 comes with sqlite3 so configure your Django project to use it. |
| 51 | |