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/run_docs.py
Then point a webbrowser to the location http://localhost:8000/. An alternative port can be specified on the command line, e.g. python ./tools/run_docs.py 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.
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 setup.py install
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 setup.py. After installation, you should delete the old install, either manually or via the command python ez_setup.py -D myghty.
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 genhtml.py utility:
cd /path/to/Myghty-X.XX/doc python genhtml.py
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 http://pythonpaste.org/download. Also required is WSGIUtils, which must be installed from a particular .egg file format, via:
python ez_setup.py http://pylons.groovie.org/files/WSGIUtils-0.6-py2.4.egg
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>/webconfig.py.
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/gen.py --help usage: gen.py [options] files... options: -h, --help show this help message and exit --croot=COMPONENT_ROOT 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