Differences between revisions 59 and 88 (spanning 29 versions)
Revision 59 as of 2008-08-18 05:46:00
Size: 2282
Editor: JimBaker
Comment:
Revision 88 as of 2014-05-22 23:24:19
Size: 2104
Editor: AdamBurke
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
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. Finally, Django works on Jython, without any special patching. Here are the steps to get Django on Jython running:
Line 5: Line 5:
So, here are the steps to get Django on Jython running.  1. First, get a fresh version of Jython. Any release after 2.5.0 should work fine.
Line 7: Line 7:
 1. First, get a fresh version of Jython, and build it:  2. Check out and install Django 1.2.5.
Line 10: Line 10:
$ svn co https://jython.svn.sourceforge.net/svnroot/jython/branches/asm/ jython-dev
$ cd jython-dev
$ ant
$ svn co http://code.djangoproject.com/svn/django/trunk/ django
$ cd django
$ jython setup.py install
Line 14: Line 14:

    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-beta-1/tarball/ Django 1.0-beta1] 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 15:
Line 36: Line 18:
$ 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 39: Line 21:
 3. Check out and install django-jython:  3. Download and install the latest release of django-jython:
Line 42: Line 24:
$ svn co http://django-jython.googlecode.com/svn/trunk/ django-jython
$ cd django-jython
$ jython25 setup.py install
$ wget http://django-jython.googlecode.com/files/django-jython-1.2.0b1.tar.gz
$ tar x
vfz django-jython-1.2.0b1.tar.gz
$ cd django-jython-1.2.0b1
$ jython setup.py install
Line 54: Line 37:
At this point, you can follow the great [http://djangoproject.com/documentation/ Django documentation], remembering to use the `jython25` command instead of `python`, and the `JYTHONPATH` variable instead of `PYTHONPATH`. Have fun! At this point, you can follow the great [[http://djangoproject.com/documentation/|Django documentation]], remembering to use the `jython25` command instead of `python`, and the `JYTHONPATH` variable instead of `PYTHONPATH`. Have fun!
Line 56: Line 39:
== Community == == Deployment ==
Line 58: Line 41:
[http://pipes.yahoo.com/pipes/pipe.info?_id=jroxOD1f3BGgvtiIqGIyXQ RSS Aggregator for blog posts about Django on Jython] See http://packages.python.org/django-jython/war-deployment.html

== 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:

 * http://tinyurl.com/bqfcco
 * http://tinyurl.com/aarjx2

'''Update (03/04/11): Not sure if this is an issue any longer, please edit if you run into it using the latest versions'''

=== Using MS SQL Server ===

The Django-Jython 1.2.0b1 release is in beta as of 03/04/11. It should be compatible with Oracle, MySQL, and PostgreSQL. If you need to use MS SQL Server, you will still need to use Django version 1.1.x until otherwise noted.

Using Django on Jython

Finally, Django works on Jython, without any special patching. Here are the steps to get Django on Jython running:

  1. First, get a fresh version of Jython. Any release after 2.5.0 should work fine.
  2. Check out and install Django 1.2.5.
    • $ svn co http://code.djangoproject.com/svn/django/trunk/ django
      $ cd django
      $ 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. Download and install the latest release of django-jython:
    • $ wget http://django-jython.googlecode.com/files/django-jython-1.2.0b1.tar.gz
      $ tar xvfz django-jython-1.2.0b1.tar.gz
      $ cd django-jython-1.2.0b1
      $ 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://packages.python.org/django-jython/war-deployment.html

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:

Update (03/04/11): Not sure if this is an issue any longer, please edit if you run into it using the latest versions

Using MS SQL Server

The Django-Jython 1.2.0b1 release is in beta as of 03/04/11. It should be compatible with Oracle, MySQL, and PostgreSQL. If you need to use MS SQL Server, you will still need to use Django version 1.1.x until otherwise noted.

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