Anda di halaman 1dari 59

Django on Jython

Jim Baker
Leo Soto
Jython Status
Shipped 2.5
(beta3)
Greatly improved
“compatibility”
setuptools
virtualenv
nose
etree
web2py
Django + Jython:

Why?
Installing this Django app...
...in an Enterprise Infrastructure
(I mean, this kind of enterprise infrastructure)
Didn't work
quite well
Guess how
much time it
took
We like Python

They need Java


Jython
Avoiding Java

Sneaking Python

Is that it?
No, it is more than
that!

(if you want)


Examples...
Steps to Deploy a Web Application

Python/Django
✔ Install Django
✔ Install 3rd party deps
✔ Install app(s)
✔ Tweak settings.py
✔ Configure web server
✔ Make sure everything is consistent
Steps to Deploy a Web Application

Java
✔ Copy/upload WAR package
Java libs can eat complex Excel data!
We can reuse
what's good on the
Java ecosystem!
Django + Jython:

Architecture
The cool side of Java

➔ System Programming
➔ Concurrency Model
➔ Memory Model
$ jython2.5
...
>>> from __future__ import GIL
$ jython2.5
...
>>> from __future__ import GIL
Traceback (most recent call last):
(no code object) at line 0
File "<stdin>", line 1

SyntaxError:
Never going to happen!
On the other
hand...
J2EE was a big, horrible mistake
The right tool for the
right job!
Java:

Performance,
Heavy lifting,
Pre-existing infrastructure
Jython:

Everything else :)
Deployment
App Servers:

Already there,
lots of features
Let's use their force!
Deployment
Options
• Java app servers - show some
horizontal scaling; also
management - sys admins know
how to do this!
• Hardened - it runs on the JVM
vs Google App
Engine Add pictures for app
engine, HBase, Hadoop

• It’s Django 1.0


• We have Unicode,
internationalization, ORM, unit
tests, admin, shell, everything!
• And we can use Java analogues:
• BigTable <=> HBase, Hypertable
• MapReduce <=> Hadoop
WAR!

• Web ARchive format


• Standard deployment for Java
app servers
• Just a bunch of files with a
standard directory layout and
manifest
$ jython manage.py war
--include-java-libs=jdbcdriver.jar
100%
self-contained!
WAR format for DoJ
super simple
bundling!

|­­ WEB­INF
|   |­­ lib
|   `­­ lib­python
|       |­­ Lib
|       |­­ django
|       |­­ doj
|       `­­ mysite
`­­ media
IDE Integration
Again, why?
Quick
Start!
Let
People
Explore
Re-
factoring
One
place to
rule
them all
Let see how that'd
be with Django...
Demo
Summary
Questions?
Thanks!
Jim's Blog:
http://www.zyasoft.com/pythoneering/

Leo's Blog:
http://blog.leosoto.com

Twitter: jimbaker, leosoto


Images used under CC license

•http://www.flickr.com/photos/purpleslog/231478071
•http://www.flickr.com/photos/21054697@N03/2053923652
•http://www.flickr.com/photos/vicintosh87/2618725412
•http://www.flickr.com/photos/dipster1/1403240351

Anda mungkin juga menyukai