Python Paste brings consistency to Python web development and web application installation, providing tools for both developers and system administrators.

a Python Web Framework built on top of WSGI?

by Ian Bicking

http://pythonpaste.org/

context/framing

URI parsing/dispatching http://pythonpaste.org/url-parsing-with-wsgi.html

<hr>

Apr'2006

PythonPaste coming from Python On Mac

Oct'2006

Dropping Rhubarb Tart, just trying Select Or with PythonPaste.

Since PythonPaste has gone v1, I'll upgrade. Since it uses Easy Install, that's easy::

Searching for Paste Reading http://www.python.org/pypi/Paste/ Reading http://pythonpaste.org Best match: Paste 1.0 Downloading http://cheeseshop.python.org/packages/2.4/P/Paste/Paste-1.0-py2.4.egg#md5=33775bbab4aa873ed691323d99893ecb Processing Paste-1.0-py2.4.egg creating /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste-1.0-py2.4.egg Extracting Paste-1.0-py2.4.egg to /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages Removing Paste 0.5 from easy-install.pth file Adding Paste 1.0 to easy-install.pth file Installed /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste-1.0-py2.4.egg Processing dependencies for Paste

You create a new app with 'paster create' (you can have different Templates). There are 2 sample apps: a To Do List that uses a Data Base back-end, and a File Browser (which uses Ware Web and a number of other libraries).

I tried a 'create' without naming a template at all::

Selected and implied templates:

Variables:

Creating template basic_package Enter version (Version (like 0.1)) ['']: 0.1 (snip) Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: Creating directory ./flux

Running /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/Mac OS/Python setup.py egg_info

An app includes directories: (app-name), docs, and tests, plus a setup.py file. I think it also includes a setup.cfg file and an '(app-name).egg-info' directory.

Here's some explanation of writing Hello World, but it doesn't tie into the app just created. Would you put this code into 'init.py'?

Things seemed odd, so I tried again specifying 'basic_template'::

Selected and implied templates:

Variables:

Creating template basic_package Enter version (Version (like 0.1)) ['']: 0.1 (snip) Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: Creating directory ./flux

Running /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/Mac OS/Python setup.py egg_info

This didn't seem to make much of a difference. Neither approach gives you a 'docs' subfolder with 'example_config.ini' or 'devel_config.ini' files (the latter seems to be where you do URI-mapping a-la Select Or).

Ian Bicking says I believe the paste_deploy template creates an ini file - basic_template potentially applies to non-web Python packages.

So try that::

Selected and implied templates:

Variables:

Creating template basic_package Enter version (Version (like 0.1)) ['']: 0.1 (snip) Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: Creating directory ./flux

Running /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/Mac OS/Python setup.py egg_info

That didn't do it either.

Jan20'2007 - upgrade all the packages (hadn't done that before), tried again. Still no success.

Even try using 'template="paste_deploy"' but that doesn't work either.

Maybe I'll just create the docs directory/files by hand, or check out the ones that are in the sample folder and copy them...::

./Paste Deploy-0.5-py2.4.egg/paste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmpl ./Paste Deploy-1.1-py2.4.egg/paste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmpl ./Rhubarb Tart-0.6dev_r5247-py2.4.egg/rhubarbtart/paste_templates/rhubarbtart/docs/devel_config.ini_tmpl

That worked, though filename ends in .ini_templ - but I just rip off the ending bit.

Try launching::

Traceback (most recent call last):

( snip many lines)

pkg_resources.Distribution Not Found: WSGIUtils

I see the wrong version of paster is running.

Go remove all the old directories in site_packages, try again::

Traceback (most recent call last):

pkg_resources.Distribution Not Found: Paste Script==0.5.2dev-r5241

Ugh, I suspect I should have deleted via Setup Tools rather than doing it directly. Or maybe it's that paster hasn't been updated::

ls gives 289 20 May 2006 paster head paster #!/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/Mac OS/Python # EASY-INSTALL-SCRIPT: 'Paste Script==0.5.2dev-r5241','paster' requires = 'Paste Script==0.5.2dev-r5241' import pkg_resources pkg_resources.run_script('Paste Script==0.5.2dev-r5241', 'paster')

Yes, I used to have a directory 'Paste Script-0.5.2dev_r5241-py2.4.egg'

Do I need to upgrade that separately from Paste Script and Paste Deploy? I thought paster was part of Python Script...

So I'm going to edit that little paster file by hand...

Then try launching again::

Traceback (most recent call last):

pkg_resources.Distribution Not Found: WSGIUtils

Feb09

Password: Searching for wsgiutils Reading http://www.python.org/pypi/wsgiutils/ Couldn't find index page for 'wsgiutils' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://www.python.org/pypi/ Reading http://www.python.org/pypi/WSGIUtils/0.7 Reading http://www.owlfish.com/software/wsgiutils/index.html Best match: WSGIUtils 0.7 Downloading http://cheeseshop.python.org/packages/2.4/W/WSGIUtils/WSGIUtils-0.7-py2.4.egg#md5=828542ebebc0f72d006b931fdfeb216f Processing WSGIUtils-0.7-py2.4.egg Moving WSGIUtils-0.7-py2.4.egg to /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages Adding WSGIUtils 0.7 to easy-install.pth file Installed /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/WSGIUtils-0.7-py2.4.egg Processing dependencies for wsgiutils

* try launch, get different error
Traceback (most recent call last):
  • File "/Library/Frameworks/Python.framework/Versions/Current/bin/paster", line 5, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 407, in run_script
    • self.require(requires)[0].run_script(script_name, ns)
    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 1084, in run_script
    • execfile(script_filename, namespace, namespace)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Script-1.1-py2.4.egg/EGG-INFO/scripts/paster", line 18, in ?

    • command.run()

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Script-1.1-py2.4.egg/paste/script/command.py", line 76, in run

    • invoke(command, command_name, options, args[1:])

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Script-1.1-py2.4.egg/paste/script/command.py", line 115, in invoke

    • exit_code = runner.run(args)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Script-1.1-py2.4.egg/paste/script/command.py", line 210, in run

    • result = self.command()

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Script-1.1-py2.4.egg/paste/script/serve.py", line 194, in command

    • relative_to=base, global_conf=vars)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Script-1.1-py2.4.egg/paste/script/serve.py", line 215, in loadapp

    • return loadapp(

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 193, in loadapp

    • return loadobj(APP, uri, name=name, kw)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 213, in loadobj

    • global_conf=global_conf)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 237, in loadcontext

    • global_conf=global_conf)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 267, in _loadconfig

    • return loader.get_context(object_type, name, global_conf)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 384, in get_context

    • global_additions=global_additions)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 454, in _filter_app_context

    • context.next_context = self.get_context(

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 393, in get_context

    • section)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 414, in _context_from_use

    • context = self.get_context(

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 345, in get_context

    • global_conf=global_conf)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 237, in loadcontext

    • global_conf=global_conf)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 274, in _loadegg

    • return loader.get_context(object_type, name, global_conf)

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 541, in get_context

    • entry_point, protocol, ep_name = self.find_egg_entry_point(

    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 562, in find_egg_entry_point

    • pkg_resources.require(self.spec)
    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 585, in require
    • needed = self.resolve(parse_requirements(requirements))
    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 464, in resolve
    • requirements = list(requirements)[::-1] # set up the stack
    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 2259, in parse_requirements

Value Error: ('Missing distribution spec', '${project}')

I posted on the email list, and Ian responded: You probably have something like "use = egg:${project}" in a config file.

Feb18'2007

(lots snipped) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Paste Deploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 573, in find_egg_entry_point

Lookup Error: Entry point 'main' not found in egg 'flux' (dir: /Users/billseitz/Documents/flux/flux; protocols: paste.app_factory, paste.composite_factory, paste.composit_factory; entry_points: )

Later play with Ro Baccia.

WebSeitzWiki: PythonPaste (last edited 2010-07-09 20:46:36 by 76-245-240-183)