Using and deploying Enamel
You do not have to install Enamel, you can simply copy it around per project and work in the base directory importing the modules as you need them.
If you wish to do a site-wide install the setup.py file will help to install Enamel as a site-package. It will not overwrite any existing Nevow or SQLAlchemy packages.
Simply run
python setup.py install
Creating an Enamel project
The best way to know how to do this is to look at the examples. These are single applications contained in a single module. Enamel has an automatic deployment wrapper which handles the job of Twisted twistd.
If you have a project which is deployed in myapp.py you can run
$ python myapp.py 2007/06/03 20:18 SAST [-] Log opened. 2007/06/03 20:18 SAST [-] twistd 2.4.0 (/usr/bin/python 2.4.3) starting up 2007/06/03 20:18 SAST [-] reactor class: <class 'twisted.internet.selectreactor.SelectReactor'> 2007/06/03 20:18 SAST [-] nevow.appserver.NevowSite starting on 8080 2007/06/03 20:18 SAST [-] Starting factory <nevow.appserver.NevowSite instance at 0xb7184a2c> 2007/06/03 20:18 SAST [-] Database started
It starts in the forground logging to the console.
If you want it to start as a daemon simply add the -d parameter
$ python myapp.py -d $
myapp.py is now running in the background. pid and log files are created based on the application name passed to deployment.run. Assuming the application name was set to 'myapp' the pid and log files are /var/run/myapp.pid and /var/log/myapp.log respectively. Twisted handles its own log rotation.
Directing Apache to your project
The ProxyPass? directive is about the best way to provide any Twisted.web application through Apache - including Enamel applications.
A simple VirtualHost? configuration would appear as follows
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName test.com
ProxyPass /test/ http://127.0.0.1:8080
</VirtualHost>
This may cause problems however - especially if you want the application to be at the root of the domain. A better way of handling this is to use the VHost system. It's already there in Enamel it's just disabled by default. Set vhostEnable = True in your Enamel application class.
Then change the ProxyPass? statement as follows
ProxyPass / http://localhost:8080/vhost/http/test.com/
