django on jython (for portland and boulder python user groups presentations)

Download Django On Jython (for Portland and Boulder Python user groups presentations)

If you can't read please download the document

Upload: leonardo-soto

Post on 16-Apr-2017

2.141 views

Category:

Technology


1 download

TRANSCRIPT

Django on Jython

Leo Soto

Not exactly Summer of Code but...

...worked incredibly well!

And that's why I'm here :)

Why Django on Jython?

Integration

Deployment

Performance

Jython

Jython

Implementation of Python

Compiles to Java bytecode

No foo.pyc

It's foo$py.class

Jython

Makes Java look like Python

And Python like Java to Java programs

No GIL, no ref counting

>>> from __future__ import GIL
Traceback (most recent call last):
...
SyntaxError: Never going to happen! (, line 1)

State of Jython 2.5

99.4% of ~5700 test cases passing

~20% faster on PyStone [FWIW]

2.5 alpha 2 last weekend for DjangoCon

September/October beta

December/January final

Java - What We Like

Great systems programming language

Well-defined memory, concurrency model

Standard libraries - concurrent collections

Java Ecosystem

Excel, thru Apache POI support of OLE

Full text search with Lucene

Scalability with Hadoop, Hbase

Scala, JRuby, Rhino...

Biggest Benefit

Just use what is good out there in the Java ecosystem

Now...

Why in the name of...

J2EE was a big, horrible mistake

But lessons have been learned

And its possible to use that infrastructure

We write Java so you dont have to.

Combination

In Python code:

Django app framework

Models, templates, forms

Business logic - as complex as necessary

In Java code (optional)

Performant infrastructure

Deployment Options

Java App Servers!

modjy

Servlets WSGI

WAR!

Web ARchive format

Standard deployment of Java webapps

Just a zip file with a standard directory layout

A Django WAR:

jython manage.py war --include-java-libs=XXX.jar

WAR format for DoJ

|-- WEB-INF

| |-- lib JDBC driver

| `-- lib-python

| |-- Lib Python Std. library

| |-- django

| |-- doj

| |-- modjy-django

| `-- mysite Your code!

`-- media (and media files)

Whats missing

PIL! so no Photolog

Oracle, MySQL, SQLServer backends

But thats easy

zxJDBC: JDBC DB-API

Django Backend Dev

Features

Operations

Client

Creation and Introspection

Validation

Wrapper

Demo

Thanks!