Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install z3c.recipe.paster

How to install z3c.recipe.paster

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install z3c.recipe.paster
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.5.3 Available View build log
Windows (64-bit)
0.5.3 Available View build log
Mac OS X (10.5+)
0.5.3 Available View build log
Linux (32-bit)
0.5.3 Available View build log
Linux (64-bit)
0.5.3 Available View build log
 
License
ZPL 2.1
Depended by
Lastest release
version 0.5.3 on Jan 5th, 2011

The z3c.recipe.paster:serve generates a paste deploy serve scripts and configuration files for starting a paste deploy based Zope 3 setup. The paste deploy *.ini file content can get defined in the buildout.cfg file.

Note, you have to define an entry_point in your projects setup.py file for using a application_factory via the section name.

Detailed Documentation

z3c.recipe.paster:serve

This Zope 3 recipes offers a Paste Deploy setup for Zope3 projects. It requires to define a Paste Deploy .ini file in the buoldout.cfg. If you need a simple PasteScript setup you can use the z3c.recipe.paster:paster recipe which allows to run already existing ``.ini`` files.

Options

The 'serve' recipe accepts the following options:

eggs The names of one or more eggs, with their dependencies that should be included in the Python path of the generated scripts.

ini The paste deploy *.ini file content.

zope.conf The zope.conf file defining the DB used in the WSGI app and the error log section.

site.zcml The zope site.zcml file used by the zope application.

Test

Lets define a (bogus) eggs that we can use in our application:

>>> mkdir('demo')
>>> write('demo', 'setup.py',
... '''
... from setuptools import setup
... setup(name = 'demo')
... ''')

Now check if the setup was correct:

>>> ls('bin')
-  buildout

We'll create a buildout.cfg file that defines our paster serve configuration:

>>> write('buildout.cfg',
... '''
... [buildout]
... develop = demo
... parts = var myapp
...
... [var]
... recipe = zc.recipe.filestorage
...
... [myapp]
... eggs = demo
... recipe = z3c.recipe.paster:serve
... ini =
...   [app:main]
...   use = egg:demo
...
...   [server:main]
...   use = egg:Paste#http
...   host = 127.0.0.1
...   port = 8080
...
... zope.conf =
...
...   ${var:zconfig}
...
...   <eventlog>
...     <logfile>
...       formatter zope.exceptions.log.Formatter
...       path ${buildout:directory}/parts/myapp/error.log
...     </logfile>
...     <logfile>
...       formatter zope.exceptions.log.Formatter
...       path STDOUT
...     </logfile>
...   </eventlog>
...
...  devmode on
...
... site.zcml =
...   <!-- inlcude other zcml files like principals.zcml or securitypolicy.zcml
...        and your app configuration -->
...   <include package="demo" file="app.zcml" />
...
... ''' % globals())

Now, Let's run the buildout and see what we get:

>>> print system(join('bin', 'buildout')),
Develop: '/sample-buildout/demo'
Installing var.
Installing myapp.
Generated script '/sample-buildout/bin/myapp'.

The bin folder contains the scripts for serve our new created paste deploy server:

>>> ls('bin')
-  buildout
-  myapp

Check the content of our new generated myapp script. As you can see, the generated script uses the paste.script.command.run for starting our server:

>>> cat('bin', 'myapp')
#!"C:\Python24\python.exe"
<BLANKLINE>
import sys
sys.path[0:0] = [
'/sample-buildout/demo',
'/sample-pyN.N.egg',
...
'/sample-pyN.N.egg',
]
<BLANKLINE>
import os
sys.argv[0] = os.path.abspath(sys.argv[0])
<BLANKLINE>
<BLANKLINE>
import paste.script.command
<BLANKLINE>
if __name__ == '__main__':
paste.script.command.run([
'serve', '...myapp.ini',
]+sys.argv[1:])

Those sample-pyN.N.egg lines should be PasteScript and it's dependencies.

Check the content of our new generated myapp.ini file:

>>> cat('parts', 'myapp', 'myapp.ini')
<BLANKLINE>
[app:main]
use = egg:demo
[server:main]
use = egg:Paste#http
host = 127.0.0.1
port = 8080
Entry point

As you probably know, there is some magic going on during startup. The section app:main in the myapp.ini file above must be defined as entry_point in your projects setup.py file. Without them, the app:main isn't available. You can define such a app:main entry point using the default application_factory offered from the z3c.recipe.paster.wsgi package. Of corse you can define your own application factory if you need to pass some additional configuration for your app to the factroy defined in your custom *.ini file.

The default entry_point offered from the z3c.recipe.paster could be included in your custom setup.py file like:

System Message: WARNING/2 (<string>, line 175)

Literal block expected; none found.

setup( name = 'something', version = '0.5.0dev', ... include_package_data = True, package_dir = {'':'src'}, namespace_packages = [], install_requires = [ 'some.package', ], entry_points = """ [paste.app_factory] main = z3c.recipe.paster.wsgi:application_factory """, )

z3c.recipe.paster:paster

This Zope 3 recipes offers a Paste Deploy script setup for Zope3 projects.

The paster part allows us to setup a plain paster executable which could be used for start up your zope server using the paste deploy ".ini file like: bin/paster serve app.ini. This recipe inherits the zc.recipe.egg class and will setup the paster within your egg dependency. All you have to do is to define your eggs. The benefit of this recipe compared with the built in PasteScript it the option to choose another name if you need more then one paster script. This is required if you have paster with different egg dependencies in one buildout configuration.

Options

The 'serve' recipe accepts the following options:

eggs The names of one or more eggs, with their dependencies that should be included in the Python path of the generated scripts.

ini The paste deploy *.ini file content.

zope.conf The zope.conf file defining the DB used in the WSGI app and the error log section.

site.zcml The zope site.zcml file used by the zope application.

Test

Lets define a (bogus) eggs that we can use in our application:

>>> mkdir('sample')
>>> write('sample', 'setup.py',
... '''
... from setuptools import setup
... setup(name = 'sample')
... ''')

Now check if the setup was correct:

>>> ls('bin')
-  buildout-script.py
-  buildout.exe

We'll create a buildout.cfg file that defines our paster configuration:

>>> write('buildout.cfg',
... '''
... [buildout]
... develop = sample
... parts = mypaster
...
... [mypaster]
... recipe = z3c.recipe.paster:paster
... eggs = sample
...
... ''' % globals())
>>> ls('bin')
-  buildout-script.py
-  buildout.exe

Now, Let's run the buildout and see what we get:

>>> print system(join('bin', 'buildout')),
Develop: '/sample-buildout/sample'
Installing mypaster.
Generated script '/sample-buildout/bin/mypaster'.

Now check if the setup was correct:

>>> ls('bin')
-  buildout-script.py
-  buildout.exe
-  mypaster-script.py
-  mypaster.exe

Check the content of our new generated paster script. As you can see, the generated script uses the paste.script.command.run for starting our server. This script is generic but uses the path of our eggs and uses the given name:

>>> cat('bin', 'mypaster')
<BLANKLINE>
import sys
sys.path[0:0] = [
'/sample-buildout/sample',
'/sample-pyN.N.egg',
...
'/sample-pyN.N.egg',
]
<BLANKLINE>
import paste.script.command
<BLANKLINE>
if __name__ == '__main__':
paste.script.command.run()
CHANGES
0.5.3 (2010-02-08)
  • Fix: add z3c.recipe.paster egg for debugging if it's not there to

System Message: WARNING/2 (<string>, line 307)

Bullet list ends without a blank line; unexpected unindent.

make sure it's installed

0.5.2 (2010-01-28)
  • Fix: add PasteScript egg if it's not there to make sure it's installed
0.5.1 (2010-01-22)
  • Added debug, an interactive debug prompt.
  • Fixed tests and fix all eggs in test setup.
  • Fixed test normalizer.
  • Updated tests, so they work with current packages.
  • Fixed tests, so they run both an Windows-like and Unix-like OS.
0.5.0 (2009-02-22)
  • Initial Release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.