WebSeitz/wikilog
Python Paste
is a Product Manager/CTO with a track-record of bringing a business perspective to building agile product-development teams for start-ups, and is seeking a senior role in an entrepreneurial organization building disruptive Internet-driven products.

(backlinks off) (map off)
(search off)
last edited by BillSeitz on Jul 1, 2009 1:29 pm

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

a built on top of ?

by

http://pythonpaste.org/

context/framing

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


Apr'2006

coming from

Oct'2006

Dropping , just trying with .

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

 easy_install --upgrade Paste
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 that uses a back-end, and a [File Browser] (which uses and a number of other libraries).

I tried a create without naming a template at all:

 ~/Documents/flux billseitz$ paster create flux
Selected and implied templates:
  PasteScript#basic_package  A basic setuptools-enabled package
Variables:
  package:  flux
  project:  flux
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
  Recursing into +package+
    Creating ./flux/flux/
    Copying __init__.py to ./flux/flux/__init__.py
  Copying setup.cfg to ./flux/setup.cfg
  Copying setup.py_tmpl to ./flux/setup.py
Running /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/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 , 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':

 ~/Documents/flux billseitz$ paster create flux template=basic_package
Selected and implied templates:
  PasteScript#basic_package  A basic setuptools-enabled package
Variables:
  package:   flux
  project:   flux
  template:  basic_package
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
  Recursing into +package+
    Creating ./flux/flux/
    Copying __init__.py to ./flux/flux/__init__.py
  Copying setup.cfg to ./flux/setup.cfg
  Copying setup.py_tmpl to ./flux/setup.py
Running /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/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 -mapping a-la ).

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

So try that:

 ~/Documents/flux billseitz$ paster create flux template=paste_deploy
Selected and implied templates:
  PasteScript#basic_package  A basic setuptools-enabled package
Variables:
  package:   flux
  project:   flux
  template:  paste_deploy
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
  Recursing into +package+
    Creating ./flux/flux/
    Copying __init__.py to ./flux/flux/__init__.py
  Copying setup.cfg to ./flux/setup.cfg
  Copying setup.py_tmpl to ./flux/setup.py
Running /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/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...:

 find . -name devel_conf*
./PasteDeploy-0.5-py2.4.egg/paste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmpl
./PasteDeploy-1.1-py2.4.egg/paste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmpl
./RhubarbTart-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:

 ~/Documents/flux/flux billseitz$ paster serve docs/devel_config.ini
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/Current/bin/paster", line 5, in ?
    pkg_resources.run_script('PasteScript==0.5.2dev-r5241', 'paster')
  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)
(***** snip many lines******)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 483, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: WSGIUtils

I see the wrong version of paster is running.

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

 paster serve docs/devel_config.ini
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/Current/bin/paster", line 4, in ?
    import pkg_resources
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 2441, in ?
    for dist in working_set.resolve(
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 483, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: PasteScript==0.5.2dev-r5241

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

 cd /Library/Frameworks/Python.framework/Versions/Current/bin
ls gives    289 20 May  2006 paster
head paster
#!/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python
# EASY-INSTALL-SCRIPT: 'PasteScript==0.5.2dev-r5241','paster'
__requires__ = 'PasteScript==0.5.2dev-r5241'
import pkg_resources
pkg_resources.run_script('PasteScript==0.5.2dev-r5241', 'paster')

Yes, I used to have a directory PasteScript-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:

 paster serve docs/devel_config.ini
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/Current/bin/paster", line 5, in ?
    pkg_resources.run_script('PasteScript==1.1', 'paster')
  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/PasteScript-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/PasteScript-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/PasteScript-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/PasteScript-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/PasteScript-1.1-py2.4.egg/paste/script/serve.py", line 192, in command
    relative_to=base, global_conf=vars)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/serve.py", line 212, in loadserver
    relative_to=relative_to, **kw)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PasteDeploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 199, in loadserver
    return loadobj(SERVER, uri, name=name, **kw)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PasteDeploy-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/PasteDeploy-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/PasteDeploy-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/PasteDeploy-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/PasteDeploy-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/PasteDeploy-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/PasteDeploy-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/PasteDeploy-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/PasteDeploy-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/PasteDeploy-1.1-py2.4.egg/paste/deploy/loadwsgi.py", line 568, in find_egg_entry_point
    possible.append((entry.load(), protocol, entry.name))
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 1829, in load
    if require: self.require(env, installer)
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 1842, in require
    working_set.resolve(self.dist.requires(self.extras),env,installer))
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 483, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: WSGIUtils

Feb09

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

Feb18'2007

Later play with .

See : | | | | | | | | | | | | | | | | | | |


 




Bill Seitz, fluxent at gmail dot com, Weblog