Differences between revisions 66 and 68 (spanning 2 versions)
Revision 66 as of 2009-02-10 01:50:31
Size: 2550
Editor: pc-40-172-161-190
Comment: removed link to yahoo pipes, added links to windows workaround for running the test suite
Revision 68 as of 2009-04-19 23:36:57
Size: 1966
Editor: pc-151-233-83-200
Comment: django-jython works ok with Jython2.5b2 and later, removing the building jython
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
 1. First, get a fresh version of Jython, and build it:  1. First, get a fresh version of Jython. Any release after 2.5b2 should work fine.

 2. Check out and install Django 1.0.X (The 1.0.2 release mostly work, but you will have to manually apply this patch: http://code.djangoproject.com/ticket/9789 .
Line 10: Line 12:
$ svn co https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython/ jython-dev
$ cd jython-dev
$ ant
$ svn co http://code.djangoproject.com/svn/django/branches/releases/1.0.X/ django-1.0.X
$ cd django-1.0.X
$ jython setup.py install
Line 14: Line 16:

    This should create a `dist/` directory inside `jython-dev/`. The jython "executable" (a shell script, actually) is under `dist/bin`. You may want to alias the command to avoid typing the whole path each time, with the command:

    {{{
$ alias jython25=/path/to/jython-dev/dist/bin/jython
}}}

    (or perhaps you prefer to add the directory to your `PATH`. Anyway, whatever works for you is OK)

 2. Check out and install Django (Note: The [[http://www.djangoproject.com/download/1.0/tarball/|Django 1.0]] release should also work, if you don't want to follow trunk)

    {{{
$ svn co http://code.djangoproject.com/svn/django/trunk/ django-dev
$ cd django-dev
$ jython25 setup.py install # Assuming you choose to use the "alias" trick explained on the previous point
}}}
Line 32: Line 17:
Line 36: Line 20:
$ alias django-admin-jy="jython25 /path/to/jython-dev/dist/bin/django-admin.py" $ alias django-admin-jy="jython /path/to/jython-dev/dist/bin/django-admin.py"
Line 44: Line 28:
$ jython25 setup.py install $ jython setup.py install

Using Django on Jython

Finally, Django works on Jython, without any special patching. Right now it is recommended to use the development version of both projects, but as soon as Django and Jython ship a new stable release, you will be able to use that too.

So, here are the steps to get Django on Jython running.

  1. First, get a fresh version of Jython. Any release after 2.5b2 should work fine.
  2. Check out and install Django 1.0.X (The 1.0.2 release mostly work, but you will have to manually apply this patch: http://code.djangoproject.com/ticket/9789 .

    • $ svn co http://code.djangoproject.com/svn/django/branches/releases/1.0.X/ django-1.0.X
      $ cd django-1.0.X
      $ jython setup.py install
      You may also like to make an alias for "django-admin.py". Very useful if you also use Django with CPython:
      $ alias django-admin-jy="jython /path/to/jython-dev/dist/bin/django-admin.py"
  3. Check out and install django-jython:
    • $ svn co http://django-jython.googlecode.com/svn/trunk/ django-jython
      $ cd django-jython
      $ jython setup.py install
  4. Start a project.
    • $ django-admin-jy startproject myproject
  5. Edit myproject/settings.py and change the DATABASE_ENGINE to doj.backends.zxjdbc.postgresql.

At this point, you can follow the great Django documentation, remembering to use the jython25 command instead of python, and the JYTHONPATH variable instead of PYTHONPATH. Have fun!

Deployment

See http://code.google.com/p/django-jython/wiki/WarDeployment

Troubleshooting

Running the test suite on Windows

Seems like there is an issue with popen() on windows, which blocks the Django test suite. You can try skipping the offending test using these two patches (against Django 1.0.2), written by Victor Ng:

DjangoOnJython (last edited 2014-05-22 23:24:19 by AdamBurke)