I've come to enjoy developing in Django - I can concentrate on the logic of the program rather than worrying about the intricacies of the language or the framework.
So I've come to setup my windows box as below so as to be quick in playing with Django. As I am a newbie myself, I am still finding out the better way to do these. But so far, it is good.
For development under windows, Instant Django (update: Instant Django seems to have gone out of the world) is the best bet. Download, Unzip into a folder, click on start.bat to play with your favorite framework. Simple isn't it? It can't get any better. By the way, do an (svn) update before you start so that you get the latest Django sources.
Since Django is about developing for web, it is necessary to have a decent browser - Firefox is my choice. Of course just because your application displays well in Firefox doesn't necessarily mean that it will display well in IE.
Another reason to love Firefox is because of the vast number of efficient plug-ins. Two of such relevant plug-ins are Firebug and SQLite Manager. Firebug helps me in designing CSS and also to locate mistakes quickly. It is an awesome tool. As I use SQLite for development purposes, SQLite Manager is a handy extension. If you are wondering whether to download Sqlite, you don't need to. 'Instant Django' package comes along with Python 2.5 and Sqlite is part of it.
So I've gotten, Python, Sqlite, Django and Firefox with its extensions. What else is pending?
A good source editor.
I use 'Programmer's Notepad' for source code editing. If you are used to Visual Studio type of editor with all fancy additions to development, PN will disappoint you for editing source files. It would be nice to pop-in the Python/Django command with the parameters and so on. But to tell you the truth, I didn't miss any such feature.
That is all needed for development. However, you might want to setup a staging environment to closely match your production environment. I setup apache/postgresql/django stack. Fundamentally it involves the below steps:
- install python
- install PIL (imaging library)
- install apache
- install postgresql
- install Psycopg
- install pgadmin
- install Tortoise SVN client
- install Django (I didn't install Django; rather copied the Django folder from Instant Django)
- install mod_python
- configure apache for Django
Each of these installations went on pretty well. The aspect that I appreciated in John's article was that, not only he explained the installation pretty well; but the steps were accompanied by screenshots, which makes it easy to comprehend.
If you are copying the Django files (as in step 8), delete the pyc (compiled python files) files. They will be generated freshly in the destination as and when they are invoked.
In addition to the apache configuration that John explains, I included aliases (by suggestion by Kellen from irc; Thank you Kellen), so that I don't have to copy the media (css/js) directories every time I update Django or I make modification to the application media. I understand from apache docs that <Directory> directive is not needed under non-windows platform. One is the path to Django admin media and the next one is to your application media.
To summarize below are added to the apache conf file:
#load mod_python LoadModule python_module modules/mod_python.so <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE cool.settings PythonDebug On PythonPath "['c:/django_projects'] + sys.path" </Location> <LocationMatch ".(jpg|gif|png)$"> SetHandler None </LocationMatch> <Location "/media"> SetHandler None </Location> <Location "/adminmedia"> SetHandler None </Location> Alias /media "C:/django_projects/cool/media" <Directory "C:/django_projects/cool/media"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> Alias /adminmedia "C:/Python25/Lib/site-packages/django/contrib/admin/media" <Directory "C:/Python25/Lib/site-packages/django/contrib/admin/media"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>
and this is an extract of the settings.py
MEDIA_ROOT = 'c:/django_projects/cool' MEDIA_URL = '/media/' ADMIN_MEDIA_PREFIX = '/adminmedia/'
That is it, to play with Django.