Juno with WSGI

Just a quick note on the wonderful Juno framework, which I've been using for a small project. Sadly the documentation isn't quite clear when it comes to deployment with mod_wsgi. At least I had some head scratching while reading through the documentation and just had to figure out how to do it.

This is what you will find in the docu:

** WSGI Notes **

Since mod_wsgi requires a function named 'application', you would need to put Juno
in 'wsgi' mode >and call run() like so:

config('mode', 'wsgi')  
application = run()

Those functions will make more sense later.

Perhaps it's just me, but it didn't make much more sense to me later. So I basically tried some stuff, until I had a working version. I'm using the config scripts from django_hoster as a basis. You might want to take a look at the templates.

Basically the only thing you will have to change in comparison to a Django WSGI deployment is the app.wsgi. From here you will have to start the Juno app for the WSGI:

1
2
3
4
5
6
7
8
#!/usr/bin/python  
import sys, os  
sys.stdout = sys.stderr  
# Here my Juno script is located
sys.path.insert(0, os.path.join(os.path.dirname(\_\_file\_\_), '..\/lib\/'))

import web                   # This is my juno script  
application = web.run()      # Start the Juno app

And that's basically all the magic you need to deploy your Juno web app with WSGI. Have fun!

Python Web