[Twisted-web] Bootstrapping for Nevow

Manuel Holtgrewe purestorm at ggnore.net
Sun May 15 17:08:31 MDT 2005


First of all, I'd like to introduce myself in three lines:

I'm Manuel Holtgrewe, stuying computer sciences in Germany. One of my  
interested is web programming and "scripting" (or better dynamically  
typed) languages like Python and (sorry to mention it in one sentence  
with it:) PHP. I am - or better was - one of the developers of the  
Binarycloud project [1] that tried to bring structure into PHP web  

I'm currently trying to replace Binarycloud with some Python based  
for my freelancing work and have reached at Nevow.


Okay, now to the real reason of this mail. I talked to some of the  
Nevow community (namely dialtone, mg and others) on IRC and they  
agreed that it might be a good idea to provide some small bootstrap  
utilities to get you started with a new Nevow page without having to  
copy anything manually from your old projects etc.

This would also lead to "best practice" for a Nevow project and help  
to "standardize" things, i.e. allow to document it and to give people  
that are new to Nevow (like me) a way to see how Things Are Done With  

Okay, the way I would imagine such a tool is shown in the thing I  
hacked up [2]. It basically only copies some files from a skelleton  
directory and sets you up with a minimal project workspace.

A quick explanations of my thougths that went into the skelleton:

|-- ntools
|   |-- __init__.py
|   |-- project.py
|-- scripts
|   |-- mkproject.py
`-- skel
     |-- doc
     |-- project
     |   |-- __init__.py
     |   `-- site
     |       |-- __init__.py
     |       |-- html
     |       |   |-- index.html
     |       `-- resources
     |           `-- header-logo.png
     `-- server.tac

  - A doc directory is created in the project's directory to hold  
things like notes and diagrams.
  - There is a module package called site that holds the things that  
are specific to the current site and are not very likely to be reused  
in other applications. Those components should go into their own  
packages parallel to "site".
  - The project.site (__init__.py) module defines the "entry points"  
for the "site" component. Things are spread into other modules in the  
site package so you don't get a 1MB Python file. Maybe that's not  
good Python style, please correct me then.
  - The project.site package contains a resources and a html  
directory that contain the root template and global images, CSS files  
etc. that are not reused in other components.

  - Other components would have their own resources directory and the  
SiteRoot rend.Page subclass will provide URLs like the following so  
all resources are at one place:
     * /resources/site/someimage.png
     * /resources/forumcomponent/somecss.css
   This has the advantage that in the CSS you can have things like  
@url(../site/someimage.png). You could, of course, make the CSS be  
dynamically generated, but I like static things because they can be  
easier to maintain.

Okay, so did I head into the completely wrong direction with my "best  
practice" proposals? If yes, please tell me what you use and I can  
learn from it and we could maybe make that tool useful.

I also think we could add things like "package" generation for  
components parallel to site.


Manuel Holtgrewe

[1] http://www.binarycloud.com
[2] http://www.ggnore.net/~mholtgrewe/misc/nevowtools.tar.gz

More information about the Twisted-web mailing list