Django on Jython
       Frank Wierzbicki
  frank.wierzbicki@sun.com
Who am I?

• Frank Wierzbicki
• Project lead for Jython
• I work at Sun (Oracle?) on Jython fulltime
What is Jython?

• Python that runs on the JVM
• Compiled to Java bytecodes instead of
  Python bytecodes
• Call Java code...
Jython Status

• Current prod version 2.2 is not useful for
  Django
• Jython 2.5 beta4 is out
• First RC as early as this...
Modjy

• Modjy implements WSGI for Jython
• Acts as a bridge to Java Servlets
• integrated into Jython’s core
• This is a ...
zxJDBC

• zxJDBC implements DB-API
• integrated into Jython’s core
• Another crucial piece to get Django
  working.
Jython on Django
         Status
• Works well with Django 1.0.3 and
  postgresql
• Other databases in progress: MySQL,
  O...
Why Jython?

• Massive amounts of Java code out there
• Some really useful Java libs
• Great JVM ecosystem
• Internal Java...
What can I use?

• setuptools
• ez_install
• virtualenv
• pip
• many more pure Python tools
What can’t I use yet?

• c-extensions
• PIL
• ctypes (but we’re working on this one!)
• iPython (working on this too!)
Configure Jython

• Get ez_setup.py
• run “jython ez_setup.py”
• In Jython’s bin directory will be an
  ez_install that run...
Installing Django on
          Jython
• Get 1.0.3+ Django - run “jython setup.py
  install”
• From http://django-jython.go...
Java Platform

• Now takes advantage of Java 5 libraries
• Java 5 concurrency libs: No GIL!
• Use a choice of Java garbage...
Java Integration

• Jython integrates well with Java
• Java classes and interfaces can be
  subclassed from Jython
• These...
Example: The Java lib
 poi can read Excel
Deployment

• run “jython manage.py war --include-java-
  libs=jdbcdriver.jar”
• This will produce a “war file”
• Copy this...
war format for doj
  |-- WEB-INF
|   |-- lib
|   `-- lib-python
|       |-- Lib
|       |-- django
|       |-- doj
|      ...
Why Django on Jython?

• Lots of ops departments out there that
  want to deploy to Java App Servers - “give
  us a war fil...
Da Vinci Machine
• JVM gets friendlier to dynamic languages
• On the project plan for JDK 7 -- some of it
  has already th...
Jython Book due in
    2009 from Apress
• Josh Juneau
• Jim Baker
• Leo Soto
• Victor NG
• Frank Wierzbicki
Where to Find Out
       More
• http://www.jython.org
• http://wiki.python.org/jython
• http://fwierzbicki.blogspot.com
• ...
Jython on Django
Upcoming SlideShare
Loading in …5
×

Jython on Django

3,542 views

Published on

EuroDjangoCon "Jython on Django" presentation

2 Comments
3 Likes
Statistics
Notes
  • This is a good ppt
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I thought it's very funny...If I can't use pil in jython...how do I use the ImageFiled in Django?Use a FileFiled instead of it?-..- maybe that's a way...
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
3,542
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
58
Comments
2
Likes
3
Embeds 0
No embeds

No notes for slide

Jython on Django

  1. 1. Django on Jython Frank Wierzbicki frank.wierzbicki@sun.com
  2. 2. Who am I? • Frank Wierzbicki • Project lead for Jython • I work at Sun (Oracle?) on Jython fulltime
  3. 3. What is Jython? • Python that runs on the JVM • Compiled to Java bytecodes instead of Python bytecodes • Call Java code seamlessly from Python code
  4. 4. Jython Status • Current prod version 2.2 is not useful for Django • Jython 2.5 beta4 is out • First RC as early as this Friday • So production release real-soon-now
  5. 5. Modjy • Modjy implements WSGI for Jython • Acts as a bridge to Java Servlets • integrated into Jython’s core • This is a big part of how we get Django working.
  6. 6. zxJDBC • zxJDBC implements DB-API • integrated into Jython’s core • Another crucial piece to get Django working.
  7. 7. Jython on Django Status • Works well with Django 1.0.3 and postgresql • Other databases in progress: MySQL, Oracle, SQLite, MS SqlServer • Django 1.1 has some refactorings that Jython will need to catch up on...
  8. 8. Why Jython? • Massive amounts of Java code out there • Some really useful Java libs • Great JVM ecosystem • Internal Java apps that are not yet exposed to the web
  9. 9. What can I use? • setuptools • ez_install • virtualenv • pip • many more pure Python tools
  10. 10. What can’t I use yet? • c-extensions • PIL • ctypes (but we’re working on this one!) • iPython (working on this too!)
  11. 11. Configure Jython • Get ez_setup.py • run “jython ez_setup.py” • In Jython’s bin directory will be an ez_install that runs from Jython
  12. 12. Installing Django on Jython • Get 1.0.3+ Django - run “jython setup.py install” • From http://django-jython.googlecode.com get django-jython-1.0b1.tar.gz, untar it and run “jython setup.py install” • see the django-jython project on googlecode.com for more detail
  13. 13. Java Platform • Now takes advantage of Java 5 libraries • Java 5 concurrency libs: No GIL! • Use a choice of Java garbage collectors • Use Java native threads • -J flag namespace for JVM config
  14. 14. Java Integration • Jython integrates well with Java • Java classes and interfaces can be subclassed from Jython • These subclasses are now “new style” classes.
  15. 15. Example: The Java lib poi can read Excel
  16. 16. Deployment • run “jython manage.py war --include-java- libs=jdbcdriver.jar” • This will produce a “war file” • Copy this war file to the auto-deploy directory for most application servers (like GlassFish)
  17. 17. war format for doj |-- WEB-INF | |-- lib | `-- lib-python | |-- Lib | |-- django | |-- doj | `-- mysite `-- media
  18. 18. Why Django on Jython? • Lots of ops departments out there that want to deploy to Java App Servers - “give us a war file” • They have lots of tools for monitoring, etc • Jython has a good story for threading and performance - and it’s getting better.
  19. 19. Da Vinci Machine • JVM gets friendlier to dynamic languages • On the project plan for JDK 7 -- some of it has already there in a hidden state for JDK6 • Method Handles, Invokedynamic, etc • Hotspot is one of the world’s best tuned VMs - about to be tuned better for us!
  20. 20. Jython Book due in 2009 from Apress • Josh Juneau • Jim Baker • Leo Soto • Victor NG • Frank Wierzbicki
  21. 21. Where to Find Out More • http://www.jython.org • http://wiki.python.org/jython • http://fwierzbicki.blogspot.com • Twitter: fwierzbicki • http://www.netbeans.org/features/python/ • https://glassfish.dev.java.net/

×