ModjyWarPackaging » History » Version 4

Alan Kennedy, 2011-02-25 09:09 PM
Corrected some speling and gramer mistakes.

1 1 Alan Kennedy
h1. Modjy WAR packaging
2 1 Alan Kennedy
3 1 Alan Kennedy
h2. Why WAR deployment.
4 1 Alan Kennedy
5 1 Alan Kennedy
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
6 1 Alan Kennedy
7 3 Alan Kennedy
 # You deploy your application using a particular directory structure. This directory structure is described in detail on the [[ModjyDeployment|modjy deployment]] page.
8 1 Alan Kennedy
 # 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.
9 1 Alan Kennedy
10 1 Alan Kennedy
So, if your application is working correctly when deployed as a directory structure, then building a WAR file is a very simple extra step.
11 1 Alan Kennedy
12 1 Alan Kennedy
h2. How to build a WAR file.
13 1 Alan Kennedy
14 1 Alan Kennedy
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.
15 1 Alan Kennedy
16 3 Alan Kennedy
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.
17 1 Alan Kennedy
18 1 Alan Kennedy
19 1 Alan Kennedy
$JAVA_HOME/bin/jar cvf WARNAME.war .
20 1 Alan Kennedy
21 1 Alan Kennedy
22 1 Alan Kennedy
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.
23 3 Alan Kennedy
24 3 Alan Kennedy
This will create a file called *WARNAME.war*, which is your web application contained in a single file.
25 3 Alan Kennedy
26 3 Alan Kennedy
h2. How to deploy a WAR.
27 3 Alan Kennedy
28 3 Alan Kennedy
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. 
29 3 Alan Kennedy
30 4 Alan Kennedy
On Apache Tomcat, the default deployment directory is called *webapps*. Simply drop your WAR file in there, and Tomcat should automatically deploy it.
31 3 Alan Kennedy
32 4 Alan Kennedy
On other containers, this directory will be different; you should read your documentation to see where you should place your WAR file.
33 1 Alan Kennedy
34 1 Alan Kennedy
h2. Django WAR packaging.
35 1 Alan Kennedy
36 1 Alan Kennedy
There is a dedicated page for [[ModjyAndDjango|django and modjy]].
37 1 Alan Kennedy
38 1 Alan Kennedy
h2. Pylons WAR packaging.
39 1 Alan Kennedy
40 2 Alan Kennedy
There is a dedicated page for [[ModjyAndPylons|django and pylons]].
Add picture from clipboard (Maximum size: 10 MB)