Hi,

Merging more of Jason's project. Again a fair amount of restructuring and
repackaging has happened here.

I'm also rapidly coming to the conclusion that packaging applications in
the first instance as Kamaelia.Apps rather than targeting the main namespace
is a good idea, largely because it simplifies the bar to merge due to the
barrier being "does this work for this application" rather than "does this
work for multiple apps, and can we have more than one of these running
at once?"

What is it?
========
It's fundamentally a Personal WSGI Server. ie something the average user
can run if it's installed on their system, change some config files in their
home directory and serve content in an adhoc way. However that content can
also be arbitrary (within some limits) WSGI applications as well.

If you build the customised distribution, and then install from that, you'll
find that inside /usr/local/bin you have an extra thing to run called
personal_wsgi_server. It's this that the user can run.

The first time you run it, it prompts you with a question regarding whether
you want to copy/install the default configuration. If you answer "y", and
return this is what you see:

~> personal_wsgi_server
It does not appear that Kamaelia WebServe has been installed.  Would you like 
to do so now? [y/n]y
INFO/kamaelia.web_common.autoinstall: Kamaelia WebServe is now done installing.
INFO/kamaelia.WebServe.main: Serving on port 8080

This creates a kp.ini file which configures the server.
It also creates a kpuser directory which contains stuff for the server
at runtime, for example ~/kpuser/www/index.html

On http://127.0.0.1:8080/ you get the output from a WSGI variable test.

http://127.0.0.1:8080/static/ is the doc root for ~/kpuser/www/ , and
displays the content of index.html ( as you might expect)

Status
======

Merged onto trunk, but is not "finished" IMO yet. This ought to move its
configuration file into ~/.kamaelia/jmb/pws.ini, and change kpuser to
something more like PWS/ or MyPWSContent/ or something.

Other than that there's been a bunch of bug fixes to get this working, as
well as namespace changes to make it "fit" better with Kamaelia's
directory structure. There's also been some bugfix work around bugs in
specific version of python (specifically a bug in 2.5.1 regarding a
conflict of zipfile & tarfiles).

I'll note though that this application does fulfill Jason's original goal
of having a simple to install server which a user can configure, since
if this is "built" for the right OS, then actually just copying the
personal_wsgi_server file to a machine is sufficient for the application
to run.

I don't think I like everything under the hood of this[1], but the result
is pretty neat. It's potentially a nice way of locally testing & serving
wsgi apps.
   [1] I don't think any two developers would ever agree on style

It would be particularly interesting to be able to provide a hosting
environment for running Google App Engine apps locally using this,
since it appears to provide a good base for that. I don't know how
practical that is though.

Playing with this
=================
In order to play with this, download the specialised distribution
from here:
   http://www.kamaelia.org/release/Kamaelia-GSOC-JMB-0.1.0.tar.gz

Install:
   # tar zxvf Kamaelia-GSOC-JMB-0.1.0.tar.gz
   # cd Kamaelia-GSOC-JMB-0.1.0/
   # sudo python setup.py install

Then run the server:
   # personal_wsgi_server
   It does not appear that Kamaelia WebServe has been installed. 
   Would you like to do so now? [y/n] y
   INFO/kamaelia.web_common.autoinstall: Kamaelia WebServe is now done 
installing.
   INFO/kamaelia.WebServe.main: Serving on port 8080

You can then point your browser at 
   http://127.0.0.1:8080/
   http://127.0.0.1:8080/static/index.html

And change configuration in ~/kp.ini and inside ~/kpuser/

As I say, these directory names probably ought to change to play nicer
with the system.

Details of Merge
================
Index: Apps/GSOC_JMB/DistBuild/
    * All the common packaging stuff.

Index: Apps/GSOC_JMB/MANIFEST.in
    * Changed to pull in all the files inside App, including the personal wsgi 
server

Index: Kamaelia/setup.py
   * Changed to pull in JMB's common files for his web server code.

Index: Kamaelia/Kamaelia/Apps/JMB/Common/
    * Collection of common core python files used/core to JMB's web
      server apps.

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/plugins/WsgiApps/django_app.py
    * Not clear on the purpose of this. Docs say it doesn't actually
      work. If that's the case, why have it here?

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/scripts
    * Directory containing the actual application

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/scripts/main.py
    * The actual main.py file for the application. Gets embedded elsewhere
      but this is the main code core.

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/make-unix.sh
    * Makes a stand alone unix "executable" of the personal wsgi server,
      that embeds a full copy of the entire relevant kamaelia libraries,
      any config files, default files etc, such that when executed it
      just runs, recreates any config files needed and then runs.

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/prepare.sh
    * Prepares/builds the main tar file comprising the personal wsgi
      server. Called by make-unix.sh

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/data/kp.ini
    * General configuration file. Defaults tend to work out of the box.

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/data/kpuser/urls.ini
    * Configuration file that tells the personal wsgi server what apps
      to run given a path matching a given regex.

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/data/kpuser/www/index.html
    * Default index.html file. Visible if you go to:
        http://127.0.0.1:8080/static/
      After installation/running, this file actually ends up living here:
        ~/kpuser/www/index.html
      So editting that allow you to have your own local website as well.

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/data/kpuser/kp.log
    * Default empty log

Index: Apps/GSOC_JMB/App/PersonalWsgiServer/zipheader.unix
    * Header file which is concatenated to the zipfile for the
      application + dependencies resulting in a "standalone"
      application, that in itself doesn't actually need anything
      installed except for python.

Regards,


Michael.
-- 
http://yeoldeclue.com/blog
http://twitter.com/kamaelian
http://www.kamaelia.org/Home

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"kamaelia" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/kamaelia?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to