Myghty Documentation
Version: 1.2 Last Updated: 07/07/10 12:55:17
View: Paged  |  One Page
  • Python 2.3.3 or greater. There is an issue with weakrefs (Python bug id 839548) prior to that version which impacts stability.
  • For production webserver usage, a server environment that supports one of: CGI, WSGI, or mod_python.
  • For mod_python usage, Apache 1.3/mod_python 2.7 (or greater) or Apache 2.0/mod_python 3.1 (or greater).
  • Tested platforms: Linux (RedHat 6.2, RedHat 9), Mac OSX, Solaris, Windows 2000. Prefork and worker MPMs tested on Apache 2.0.
  • Familiarity with the webserver being used and whatever plug-in architecture being used.
back to section top
Quick Start - Running the Demo Server

Myghty includes an out-of-the-box instant-gratification examples/documentation server you can run directly from the distribution files, which listens on port 8000 by default. Extract the distribution from its .tar.gz file. Then run the server as follows:

cd /path/to/Myghty-X.XX/
python ./tools/

Then point a webbrowser to the location http://localhost:8000/. An alternative port can be specified on the command line, e.g. python ./tools/ 8100.

The demo server is a handy tool to browse through a release without having to perform an install. The underlying HTTP server implementation can also be handy for development and prototyping.

back to section top
Installing the Library

Myghty now installs with setuptools, which is the next generation of the standard Python distutils module. Its basic usage is the same as that of distutils. Switch to the user account under which Python is installed, and run:

cd /path/to/Myghty-X.XX/
python install
As some systems may have multiple Python interpreters installed, be sure to use the Python executeable that corresponds to the Python being used by the webserver, such as the mod_python configuration, to insure the files go into the correct library path. will precompile the Myghty .py files and install them in the library path for the Python executeable you just ran.

This installer also installs Myghty in a version-specific location, such as "site-packages/Myghty-0.99-py2.3.egg/". If you have installed a version of Myghty prior to 0.99, the distutils-based installation, which lives in "site-packages/myghty", will produce a conflict message when running After installation, you should delete the old install, either manually or via the command python -D myghty.

back to section top
Generating the Documentation

This documentation can also be generated into flat html files that are browseable directly from the filesystem. Myghty can create these files by running the utility:

cd /path/to/Myghty-X.XX/doc
back to section top
Running Paste Templates

Myghty now includes a few Python Paste templates, which are pre-built Myghty applications that can install themselves into a runnable application. Python 2.4 is required to run Python Paste.

Myghty's standard install procedure will automatically download and install all Python Paste components, which are also available at Also required is WSGIUtils, which must be installed from a particular .egg file format, via:


When Python Paste is installed, it will install the script "paster" into the standard Python scripts location. Insure that this location is in your path. Then to set up a Paste Template, just do:

cd /target/directory
paster create --template=myghty_simple myproject
cd myproject
        paster serve server.conf

The myghty_simple template is a very small four-template configuration, which will by default listen on port 8080. Also included is myghty_modulecomponent, which shows off a more controller-oriented configuration, and myghty_routes, which builds a new Rails-like "Routes" configuration.

When a new Paste Template project is created, the file <projectname>/server.conf illustrates the general Paste options, such as the server listening port. Myghty-specific configuration information is in <projectname>/<projectname>/

back to section top
Running Filesystem Components

There is also a generic tool for running any Myghty template either to standard output or to a file. The command is as follows:

python tools/ --help

usage: [options] files...

  -h, --help            show this help message and exit
                        set component root (default: ./)
  --dest=DESTINATION    set destination directory (default: ./)
  --stdout              send output to stdout
  --datadir=DATADIR     set data directory (default: dont use data directory)
  --ext=EXTENSION       file extension for output files (default: .html)
  --source              generate the source component to stdout
back to section top