Exit Print View

Sun GlassFish Enterprise Server v3 Scripting Framework Guide

  This Document Entire Library
Print View

Document Information

Preface

1.  Using JRuby on Rails With Sun GlassFish Enterprise Server

2.  Developing Grails Applications

3.  Jython on Django

Overview

Installing Jython and Django

To Install Jython as Standalone

To Install Jython from Update Center

To Install Django

To Install Jython Container for Sun GlassFish Enterprise Server

To Install Jython Support Libraries for Django

Creating and Deploying a Simple Jython Application using Django

To Create a Simple Django Project

To Deploy a Django Application From Command Line

asadmin CLI for Jython

Using the Django Administration Utility

Further Information

4.  Scala and Lift

5.  PHP

Creating and Deploying a Simple Jython Application using Django

After completing the software installations, you are ready to create Jython applications using Django. This section explains how to create a simple application. GlassFish users can deploy Django applications with the directory deployment method.

To 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-location/bin/django-admin.py"

  2. Change to Django install directory:

    cd django-install-location

  3. Use the following command to create a project:

    django-admin-jy startproject <myproject>

To Deploy a Django Application From 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.

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

    cd /tools/jython/projects

  3. Use the following command to deploy the application:

    asadmin deploy myproject/

asadmin CLI for Jython

The asadmin deploy command allows you to set deployment specific properties for the Jython applications. The following table lists these properties.

Jython Properties
Property
Default Value
Possible Value
Description
jython.home
None
Path to a directory
Path to a Jython installation. Required.
jython.mediaRoot
None
Path to a directory
Optional parameter containing the path to the location, for server to serve the static files.
jython.frameworkRoot
None
Path to a directory
Optional parameter containing the path of the framework being used. Currently supports Django.
jython.applicationType
None
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 Django directory as follows:

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

These values are persistent in the domain.xml file.