DurusWorks is a web application framework that brings together the key tools developed at the MEMS and Nanotechnology Exchange at Corporation for National Research Initiatives. At CNRI, the current maintainer of DurusWorks is Roger Masse.
The DurusWorks Documentation | |
---|---|
Durus® | the transactional object database for Python |
QP | site management, form framework, users, sessions, authentication |
Qpy | programmer-oriented HTML assembly tool |
Sancho | simple unit test framework |
SCGI Details | details of the SCGI protocol |
mod_scgi | the Apache2 SCGI module |
There are many ways to install and use DurusWorks. Rather than try to describe all of the options, we will describe the way we choose to install and use DurusWorks on the OSX and Linux machines. We will refer to this arrangement as a "standard installation".
In the standard installation, we put almost everything under a /www
directory. You can use another directory name if you like, but we'll assume
throughout these documents that your installation is all under /www
.
To get started, log in as root and execute these commands to make the
standard directories (which we assume do not already exist).
mkdir /www
mkdir /www/trunk
mkdir /www/pythonlib
mkdir /www/bin
mkdir /www/var; chmod 777 /www/var
mkdir /www/qp_sites
mkdir /www/ssl
mkdir /www/cgi-bin
mkdir /www/conf
The subdirectories are populated as follows:
DurusWorks
distribution.
Download the current DurusWorks distribution tarball and unpack it in /www/trunk
.
The DurusWorks
created by unpacking the tarball may have a version number
suffix. Rename the directory to remove the suffix.
Next, compile and install in-place the DurusWorks
C-extension modules by
doing this:
cd /www/trunk/DurusWorks
python setup.py build_ext -i
rm -r build
While we are working in /www/trunk
, go ahead and
install the Apache2 mod_scgi module by doing this:
cd /www/trunk/DurusWorks/scgi
sudo make install; sudo make clean
PYTHONPATH
environment variable, or by other means. You may, for example, edit your
.profile
to include this:
export PYTHONPATH=/www/pythonlib
To initialize this directory, do this:
cd /www/pythonlib
sudo ln -s /www/trunk/DurusWorks/durus .
sudo ln -s /www/trunk/DurusWorks/qp .
sudo ln -s /www/trunk/DurusWorks/qpy .
sudo ln -s /www/trunk/DurusWorks/sancho .
PATH
environment variable.
It contains symlinks to command-line tools in the trunk.
You may, for example, edit your .profile
to include
export PATH=/www/bin:$PATH
To initialize this directory, do this:
cd /www/bin
sudo ln -s /www/trunk/DurusWorks/durus/durus .
sudo ln -s /www/trunk/DurusWorks/qp/bin/qp .
sudo ln -s /www/trunk/DurusWorks/qp/bin/qpcensus.py .
sudo ln -s /www/trunk/DurusWorks/qpy/qpcheck.py .
sudo ln -s /www/trunk/DurusWorks/qpy/qpyrun.py .
sudo ln -s /www/trunk/DurusWorks/sancho/urun.py .
var_directory='/www/var
in the SitePublisher.configuration
dictionary.
Let's set up the site called proto
.
To initialize the demo site and this directory, do this:
sudo cp -r /www/trunk/DurusWorks/proto /www/trunk/proto
cd /www/qp_sites
sudo ln -s /www/trunk/proto/site proto
cd /www/pythonlib
sudo ln -s /www/trunk/proto/lib proto
sudo openssl req -new -x509 -nodes -days 365 -out /www/ssl/self.pem -keyout /www/ssl/self.pem
/etc/apache2/httpd.conf
file with a symlink to a complete Apache config here, or else we append an directive to the standard httpd.conf
that includes the contents of a file in this directory.
For the proto demo application, append
Include /www/conf/apache2_proto.conf
to /etc/apache2/httpd.conf
and also do this:
ln -s /www/turnk/proto/conf/apache2_proto.conf /www/conf/apache2_proto.conf
In the standard installation, the applications are also defined in packages in the
/www/trunk
directory. To provide an example of how we organize the code
for an application, we'll describe the parts of the demo site called proto
.
proto
site.
proto
python package.
In the standard installation, /www/pythonlib
contains a symlink
named proto
that points to this directory.
This directory typically contains python modules and subpackages that
define the data structures and business logic of the site.
proto
specifically related to
defining the URL space and constructing web pages. All .qpy
files for the site are in this directory or subpackages of it.
As with all packages that contain .qpy
files, the
__init__.py
file must contain the commands to run the compiler:
from qpy.compile import compile_qpy_files
compile_qpy_files(__path__[0])
This directory contains a slash.qpy
that defines
SitePublisher
and SiteDirectory
classes.
These classes define the site's configuration.
DocumentRoot
of the site in the Apache configuration.
__init__.py
and
a slash.py
with this one line:
from proto.ui.slash import import SitePublisher, SiteDirectory
/www/conf