UPDATE: A simpler version of these instructions is available on the django-ironpython Bitbucket page.
This guide will explain how to setup and attempt to run the Django test suite on IronPython. Once the test suite runs, it should be much easier to fill in the parts of Django that don't work properly.
What You'll Need
It's not terribly difficult to set this up, but there are quite a few pieces.
- IronPython 2.6 – use the installer so that you get the standard library as well.
- Django trunk – an SVN checkout for now; if you have Mercurial, you can get it from django-ironpython. Following the hg repo will get you my IronPython fixes.
- adonet-dbapi – For the sqlite3 module implementation – MS SQL is a future target, but not right now (use the "get source" link if you don't have hg installed).
- System.Data.SQLite – used by the sqlite3 module (just download the binary zip; no need to install)
- 1 cup flour…
First up, install IronPython and checkout the Django trunk and adonet-dbapi somewhere. I'll use %USERPROFILE%\Documents\Repositories\django\ and %USERPROFILE%\Documents\Repositories\adonet-dbapi\ in these examples. Next, create a "DLLs" folder in the IronPython install folder and drop System.Data.SQLite.dll into it (this way IronPython will automatically reference it).
The next step is to prepare the Django test suite. This requires you to create a small Django app that contains things like database settings. The full instructions can be found on Alex Gaynor's blog, or you can download it and unzip it (I'll assume %USERPROFILE%\Documents\Repositories\django-test\).
Running the Tests
OK, command prompt time – if you're not comfortable with the command prompt, this won't be for you.
set PATH=%PATH%;C:\Program Files (x86)\IronPython 2.6 set IRONPYTHONPATH=%USERPROFILE%\Documents\Repositories\django\;%USERPROFILE%\Documents\Repositories\adonet-dbapi\abapi;%USERPROFILE%\Documents\Repositories\django-test\ set DJANGO_SETTINGS_MODULE=django_test.settings
Now, make sure you're in the django directory and run the test cases:
cd %USERPROFILE%\Documents\Repositories\django\ ipy tests\runtests.py -v 1
So far, so good.
It'll bomb immediately on an assertion failure. Django does not like the fact that on IronPython str == unicode and thus their lazy evaluation doesn't work immediately (see issue #1 for details). Comment out that assertion, and it fails again – and I haven't fixed this one yet. Stay tuned.