Snakelets
What is it? Snakelets is a very simple-to-use Python web application server. It provides a threaded web server (you don't have to provide a web server such as Apache yourself), Ypages (Python HTML template language, similar to Java's JSPs) and Snakelets: code-centric page request handlers (similar to Java's Servlets). Snakelet's focus is to make the creation of dynamic web sites as quick and easy as possible. To get started it is enough to extract Snakelets somewhere, add a single directory that will contain your files, copy-paste-edit a small configuration file that describes your site, and you're set to add your own pages and images and other content!
The project's home page is at http://snakelets.sourceforge.net You will also find my (IrmenDeJong) email adress there.
For the latest version, grab Snakelets from CVS.
Hosting providers that accept Snakelets
[http://www.python-hosting.com Python-hosting.com] - Friendly people, quick to respond. You're allowed to run your own server software, and have full shell account access. You can even compile and install your own software.
Web sites built with (or using) Snakelets
See SnakeletsSites.
Tips
For Snakelets up to version 1.44, add microseconds to the serverlog by editing the following in logging.cfg:
[formatter_logFmt] datefmt=%Y-%m-%d %H:%M:%S format=[%(asctime)s.%(msecs)03d,%(module)s,%(levelname)s] %(message)s
- When trying to set up Snakelets, if you can access the default ROOT webapp from 127.0.0.1 -- or your hostname as specified in your hosts file -- but not by entering in your computer's local IP address, try setting the 'bindname' variable in serv.py to that local IP address (i.e. 192.168.0.x).
CHANGED IN NEW VERSION (1.45cvs)
- Fixed HTTP DIGEST AUTH code, but it's still disabled because it cannot be supported. It requires plain text passwords, which Snakelets doesn't store. Documented this fact.
- added microseconds to the serverlog timestamps.
- bit better error when logging.cfg cannot be found (for instance because it is not in your current directory)
- when a crash occurs in an Ypage, the traceback is now logged as well (not only the exception string)
TODO LIST FOR A FUTURE VERSION
- add the Kronos sleep bug fix
- add a client-IP blacklist (and edit option in management screens) IP-pattern, date, reason
- fix the multi-level page include nesting bug
- fix the content-type bug when using page inclusion
- finish the "effective ypages" chapter
- add some database storage examples (sqlite, mysql)
use [http://routes.groovie.org/ Routes] for url-to-class mappings
- change config mechanism to use external .ini files instead of having to edit Python source.
- experiment with some XMLHTTPRequest javasscript AJAX stuff; there was a possible issue with this that the responses from Snakelets were empty?? If so, this is a bug that should be fixed.
- When reloading a webapp, and it crashes due to a programming error, the webapp is gone from the mgmt console. Fix this, so that you can reload again after fixing the error in the webapp. The reload button is already there but it doesn't work.
I'm thinking about stopping further development of Snakelets in its current form. There will NOT be a Snakelets 2.0. There are too many (semi)professional web frameworks already in existence. The raison d'etre from Snakelets was to be a learning process for myself, and to provide a simple and easily usable web development platform. I don't plan to venture with Snakelets into the area of (semi)professional web frameworks like CherryPy or Twisted. Actually I'd rather use one of those (Turbogears?) for future web app development...
IDEAS THAT WILL PROBABLY NEVER MAKE IT
- integrate SSL patch (on SF)
- login forms; add password encryption using javascript (like gathering.tweakers.net)
Request plugins (such as the compressor): can they be fixed now to also trigger on static pages? Perhaps we need a lower-level plugin, to be able to compress static files too (for instance)? (tweak wfile output stream to gzip stream???) See http://www.xhaus.com/alan/python/httpcomp.html Then again: why not just create 'dummy' request and response wrapper object instances to be able to treat static file requests as if they were for dynamic pages..? -->performance suffers
- Improve and stabilize Plugin mechanism
- treat webapps as installable modules: URL entry, download+install function in management interface. (needs standard webapp archive format, a bit like a .WAR)
- webapps could have config/mgmnt pages, and documentation, that would be accessible from within the mgmt webapp interface.
- mgmt webapp is central authorizer for admin accounts. Make example webapp (Frog+filemgr?) that show how you could use the mgmt admin user base to authorize admin accounts, if desired (instead of defining your own admin accounts again in each webapp)
- mgmt webapp should also have admin-user management pages to edit the admin user accounts for the mgmt webapp (and other webapps too, via the predefined webapp structure that provides their own hooks for this)
better support for 'friendly urls' (http://.../app/user/joe/view instead of http://.../app/user.y?u=joe&a=view)
make Snakelets WSGI ([http://www.python.org/peps/pep-0333.html PEP-333]) compatible
implement a form of [http://zope.org/Documentation/Books/ZDG/current/Acquisition.stx acquisition]. Configurable on/off. Goal is that when you refer to a resource (page), by redirecting or including or whatever, that snakelets will try to find the resource also in 'higher' levels up in the url/filesystem path.
- multiple 'connectors' (server socket ports that snakelets is listening on). Also define in vhost config which vhosts are active on which connector
Can we use [http://peak.telecommunity.com/doc/index.html PEAK]?
- can't the snakelet and .y-handling code be combined more? Mind future additions to the logic to generalize .y /template pages!
- abstract out the .y handling into a generic suffix-based template engine system. Make the .y -handling code into a template engine plugin.
add persistent session (login cookie) to account example. Store session somewhere (SessionStore; in memory/on disk/in database...)
- finally add the cheetah template engine as a true plugin with its own .tmpl files.
- finally add the spyce template engine with .spy filetype.
add http://www.owlfish.com/software/simpleTAL/ !SimpleTAL?
look at PyMeld templating: http://www.entrian.com/PyMeld/ ? (There's also PyMeldLite)
- HTTP keep-alive connections are not supported, they should be!
HTTP pipelining doesn't work. It should? Nasty to get right. Read about [http://www.mozilla.org/projects/netlib/http/pipelining-faq.html HTTP 1.1 pipelining].
If cookies are off, many sessions are generated? --> put it in the URL? How to check if cookies are off?
change needless getters/setters to properties --> major API overhaul
Use PLY http://systems.cs.uchicago.edu/ply/ or pyparsing: http://sourceforge.net/projects/pyparsing/ for tokenizing and parsing Ypages ??
- Make easy apache integration: (Mind POST requests and file uploads...)
- - mod_webkit adapter - fastcgi? mod_python? - cgi can't be used because of statefulness of the sessions.
- Perhaps best to decouple the server code from Python's http server, so that we can use various 'adapters' that talk to the uniform snakelet server interface (socket). The snakelet server has to be a socket server. Forked or Threaded (with process/thread pool that grab requests from the queue). Or based on asyncore.
Asyncore web server: http://effbot.org/librarybook/asynchat.htm
- Facilitate VIEW (Ypage) and CONTROLLER+MODEL(snakelet). ??
add HTTPS support using !PyOpenSSL (see CherryPy) or M2Crypto or [http://www.stunnel.org/ Stunnel] or [http://trevp.net/tlslite/ !TLSlite] ?
Do you have something to say? Go ahead, type it in right here! If you want a quick response, use the [http://lists.sourceforge.net/lists/listinfo/snakelets-list Mailing List ] (preferred) or mail me directly. You can contact me via [http://snakelets.sourceforge.net Snakelet's project home page].
