Oracle GlassFish Server 3.0.1 Scripting Framework Guide

Creating and Deploying a Simple Jython Application using Django

After completing the software installation procedures described in Installing Jython and Django, you are ready to create Jython applications using Django. This section explains how to create a simple application. GlassFish Server users can deploy Django applications with the directory deployment method.

ProcedureTo Create a Simple Django Project

Django comes with a built-in administration utility. You can enable it to make the process of creating projects easier.

  1. Use the following command to enable the Django administration utility:

    alias django–admin-jy="jython jython-install/bin/"
  2. Change to Django install directory:

    cd django-install
  3. Use the following command to create a project:

    django-admin-jy startproject myproject

ProcedureTo Deploy a Django Application From the Command Line

To deploy a Django application from the command line using the asadmin command, do the following:

  1. Make sure JYTHON_HOME and PATH environmental variables are set, as described in Installing Jython and Django.

  2. Change to the directory containing the project. For example:

    cd /tools/jython/projects
  3. Use the following command to deploy the application:

    as-install/bin/asadmin deploy myproject/

asadmin CLI for Jython

The asadmin deploy command enables you to set several deployment-specific properties for Jython applications. Table 3–1 lists these properties.

Table 3–1 Jython Deployment Properties


Default Value 

Possible Value 




Path to a directory 

Path to a Jython installation. Required. 



Path to a directory 

Optional parameter containing the path to the location, for server to serve the static files. 



Path to a directory 

Optional parameter containing the path of the framework being used. Currently supports Django. 



String representing application type such as Django 

Optional parameter to specify the framework, including non-Django applications. 

Use the following command syntax to set these properties:

asadmin deploy --property property=value

For example, you can set the jython.frameworkRoot property to the Django directory as follows:

asadmin deploy --property jython.frameworkRoot=django-install

These values are persistent in the domain.xml file.