Modjy WAR packaging

Why WAR deployment.

When you deploy WSGI web applications in a java servlet container, such as Apache Tomcat or Glassfish , there are two different ways you can deploy

  1. You deploy your application using a particular directory structure. This directory structure is described in detail on the modjy deployment page.
  2. You can deploy your application as a single file. This file is a WAR file , and actually is an archive of the same directory structure described above.

So, if your application is working correctly when deployed as a directory structure, then building a WAR file is a very simple extra step.

How to build a WAR file.

First, build the directory structure of your application. If you're not certain how to build this structure, a simple way forward is to take the demo modjy_webapp directory from the jython distribution, and tweak that structure to meet your needs.

When you're happy with the contents of the directory hierarchy, execute a command like this, in the top level of your web applications directory hierarchy, e.g. the modjy_webapp directory.

$JAVA_HOME/bin/jar cvf WARNAME.war .

Where WARNAME is the name of the WAR file you want to create, and $JAVA_HOME refers to the location where your JDK or JRE is installed.

This will create a file called WARNAME.war, which is your web application contained in a single file.

How to deploy a WAR.

Now that you have a single file containing your web application, you simply need to copy that file to the directory in your servlet container where web applications should reside.

On Apache Tomcat, the default deployment directory is called webapps. Simply drop your WAR file in there, and Tomcat should automatically deploy it.

On other containers, this directory will be different; you should read your documentation to see where you should place your WAR file.

Django WAR packaging.

There is a dedicated page for django and modjy.

Pylons WAR packaging.

There is a dedicated page for django and pylons.

Updated by Alan Kennedy over 13 years ago ยท 4 revisions