[Checkins] SVN: Sandbox/philikon/mkzopeapp/trunk/ mkzopeapp, an alternative to mkzopeinstance. Read README.txt for a detailled

Philipp von Weitershausen philikon at philikon.de
Fri Jul 6 10:55:40 EDT 2007


Log message for revision 77517:
  mkzopeapp, an alternative to mkzopeinstance. Read README.txt for a detailled
  run-down of how to use it...
  

Changed:
  A   Sandbox/philikon/mkzopeapp/trunk/
  A   Sandbox/philikon/mkzopeapp/trunk/README.txt
  A   Sandbox/philikon/mkzopeapp/trunk/buildout.cfg
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/__init__.py
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/__init__.py
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/configure.zcml_tmpl
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/develop.ini
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/main.py_tmpl
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/var/
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/var/README.txt
  A   Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/setup.py_tmpl
  A   Sandbox/philikon/mkzopeapp/trunk/setup.py

-=-

Property changes on: Sandbox/philikon/mkzopeapp/trunk
___________________________________________________________________
Name: svn:ignore
   + mkzopeapp.egg-info
bin
parts
.installed.cfg
eggs
develop-eggs


Added: Sandbox/philikon/mkzopeapp/trunk/README.txt
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/README.txt	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/README.txt	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,122 @@
+With ``mkzopeapp`` you can start a new Zope-based web application from
+scratch with just one command::
+
+  $ mkzopeapp MyZopeProj
+
+This will create a directory called ``MyZopeProj``.  In it, you will
+find a typical development sandbox for a Python package: a
+``setup.py`` file and an empty package called ``myzopeproj`` in which
+you can now place the code for your application.  Actually, the
+package is not entirely empty, it contains a sample application
+configuration (``configure.zcml``) and a sample server configuration
+for development (``develop.ini``).
+
+Starting the application
+------------------------
+
+In order to start the application, you will have to enable the newly
+created package as an egg.  This is best done by activating it as a
+*development egg* using the following command::
+
+  $ python2.4 setup.py develop -f http://download.zope.org/distribution
+
+This will not only activate the ``MyZopeProj`` egg, it will also
+install all of its dependencies, most importantly the Zope libraries
+themselves (that's also why we need to point it to the download
+location of Zope libraries).  This might take a little while, by the
+way.
+
+Note that both the downloaded eggs as well as the development egg will
+be installed into the global ``site-packages`` directory of the
+``python2.4`` interpreter you're using.  To avoid that, it is
+recommended to use workingenv_ or `zc.buildout`_ to confine the
+installation to a local sandbox (see next section).
+
+When ``MyZopeProj`` is enabled as an egg, it installs a new
+executable, ``startMyZopeProj``.  This will start the server with the
+development configuration (``develop.ini``)::
+
+  $ .../bin/startMyZopeProj
+
+.. _workingenv:
+.. _zc.buildout:
+
+Using workingenv for a sandbox installation
+-------------------------------------------
+
+workingenv_ provides an easy way to do egg-based development without
+polluting your global Python installation with different versions of
+downloaded eggs and development eggs.  Instead, a workingenv-based
+sandbox contains its own eggs and (at least by default) ignores any
+globally installed eggs.
+
+To turn the ``MyZopeProj`` directory into a workingenv sandbox,
+execute::
+
+  $ python workingenv.py MyZopeProj
+
+outside the ``MyZopeProj`` directory.  After that, we only have to
+*activate* the sandbox for the current interpreter session::
+
+  $ cd MyZopeProj
+  $ bin/activate
+
+Now we can proceed to activate the ``MyZopeProj`` egg::
+
+  $ python2.4 setup.py develop -f http://download.zope.org/distribution
+
+This is in fact the same line as above, except that it will install
+the downloaded dependencies and the ``MyZopeProj`` development egg
+into the local sandbox.
+
+After the installation we can find the ``startMyZopeProj`` executable
+in the ``bin`` sub-directory of the ``MyZopeProj`` directory.
+
+Using zc.buildout for a sandbox installation
+--------------------------------------------
+
+Like workingenv, zc.buildout_ also provides an easy way to work with
+eggs in sandboxes without polluting the global Python installation.
+An advantage of buildout over workingenv is that we create a
+configuration file (``buildout.cfg``) that specifies what we want to
+install and then run the buildout command to perform the installation.
+That way the sandbox creation with all the dependency installation is
+repeatable (e.g. for co-workers).
+
+To turn our ``MyZopeProj`` directory into a buildout sandbox, we add a
+``buildout.cfg`` file::
+
+  [buildout]
+  develop = .
+  find-links = http://download.zope.org/distribution
+  parts = app
+
+The first line after the section header tells buildout to call
+``setup.py develop`` in the current directory (we no longer have to do
+that manually!).  The second line tells it where to find the Zope
+dependencies.  Finally, the third line specifies a configuration
+section that tells buildout what to install and that we yet have to
+write::
+
+  [app]
+  recipe = zc.recipe.egg
+  eggs = MyZopeProj
+
+The first line after the section header tells buildout that we simply
+want to install an egg (buildout has different recipes that can
+install anything between an old-fashion Unix tarball to a modern egg).
+The second line tells it which egg to install.
+
+Now we need to bootstrap the sandbox and execute the buildout::
+
+  $ buildout bootstrap
+  ...
+  $ buildout
+  ...
+
+This obviously requires that you already have installed
+``zc.buildout`` and that the ``buildout`` executable is on your path.
+
+After running the buildout, we can find the ``startMyZopeProj``
+executable in the ``bin`` sub-directory of the ``MyZopeProj``
+directory.


Property changes on: Sandbox/philikon/mkzopeapp/trunk/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Sandbox/philikon/mkzopeapp/trunk/buildout.cfg
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/buildout.cfg	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/buildout.cfg	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,7 @@
+[buildout]
+parts = mkzopeapp
+develop = .
+
+[mkzopeapp]
+recipe = zc.recipe.egg
+eggs = mkzopeapp

Added: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/__init__.py
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/__init__.py	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/__init__.py	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,12 @@
+import sys
+from paste.script import templates, command
+
+class ZopeApp(templates.BasicPackage):
+    _template_dir = 'template'
+    summary = 'Package that contains a Zope application'
+    required_templates = []
+    vars = []
+
+def main():
+    extra_args = sys.argv[1:]
+    command.run(['create', '-t', 'zope_app'] + extra_args)


Property changes on: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/__init__.py
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/__init__.py	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/__init__.py	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1 @@
+# Make this directory a package


Property changes on: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/configure.zcml_tmpl
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/configure.zcml_tmpl	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/configure.zcml_tmpl	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,53 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           i18n_domain="{{package}}">
+
+  <include package="zope.security" file="meta.zcml" />
+  <include package="zope.i18n" file="meta.zcml" />
+  <include package="zope.app.securitypolicy" file="meta.zcml" />
+  <include package="zope.app.zcmlfiles" file="meta.zcml" />
+
+  <include package="zope.annotation" />
+  <include package="zope.copypastemove" />
+  <include package="zope.formlib" />
+  <include package="zope.i18n.locales" />
+  <include package="zope.publisher" />
+  <include package="zope.size" />
+  <include package="zope.traversing" />
+  <include package="zope.traversing.browser" />
+  <include package="zope.publisher" />
+  <include package="zope.app.zcmlfiles" />
+  <include package="zope.app.securitypolicy" />
+  <include package="zope.app.authentication" />
+  <include package="zope.app.session" />
+
+  <securityPolicy 
+      component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+  <unauthenticatedPrincipal id="zope.anybody"
+                            title="Unauthenticated User" />
+  <unauthenticatedGroup id="zope.Anybody"
+                        title="Unauthenticated Users" />
+  <authenticatedGroup id="zope.Authenticated"
+                      title="Authenticated Users" />
+  <everybodyGroup id="zope.Everybody"
+                  title="All Users" />
+  <principal id="zope.manager"
+             title="Manager"
+             login="admin"
+             password_manager="Plain Text"
+             password="admin"
+             />
+
+  <!-- Replace the following directive if you don't want public access -->
+  <grant permission="zope.View"
+         principal="zope.Anybody" />
+  <grant permission="zope.app.dublincore.view"
+         principal="zope.Anybody" />
+  
+  <role id="zope.Manager" title="Site Manager" />
+  <role id="zope.Member" title="Site Member" />
+  <grantAll role="zope.Manager" />
+  <grant role="zope.Manager"
+         principal="zope.manager" />
+
+</configure>

Added: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/develop.ini
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/develop.ini	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/develop.ini	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,9 @@
+[app:main]
+use = egg:zope.paste
+site_definition = configure.zcml
+file_storage = var/Data.fs
+
+[server:main]
+use = egg:PasteScript#wsgiutils
+host = 127.0.0.1
+port = 8080

Added: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/main.py_tmpl
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/main.py_tmpl	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/main.py_tmpl	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,8 @@
+import os.path
+import {{package}}
+import paste.script.command
+
+def main():
+    conf_file = os.path.join(os.path.dirname({{package}}.__file__),
+                                             'develop.ini')
+    paste.script.command.run(['serve', conf_file])

Added: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/var/README.txt
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/var/README.txt	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/var/README.txt	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,3 @@
+This directory contains files for Zope's object database (ZODB)
+storage.  You can change where these files are stored by editing
+the paste.ini configuration file.


Property changes on: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/+package+/var/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/setup.py_tmpl
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/setup.py_tmpl	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/mkzopeapp/template/setup.py_tmpl	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,40 @@
+from setuptools import setup, find_packages
+
+setup(name={{repr(project)}},
+
+      # Fill in project info below
+      version='0.1',
+      description="",
+      long_description="",
+      # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+      classifiers=[],
+      keywords='',
+      author='',
+      author_email='',
+      url='',
+      license='',
+
+      packages=find_packages(),
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=['setuptools',
+                        'ZODB3',
+                        'zope.interface',
+                        'zope.schema',
+                        'zope.component',
+                        'zope.app.authentication',
+                        'zope.app.security',
+                        'zope.app.securitypolicy',
+                        'zope.app.zcmlfiles',
+
+                        # these are needed for PasteDeploy-based deployment
+                        'PasteScript',
+                        'PasteDeploy',
+                        'zope.paste',
+                        'WSGIUtils',   # contains standard HTTP server
+                        ],
+      entry_points="""
+      [console_scripts]
+      start{{project}} = {{package}}.main:main
+      """,
+      )

Added: Sandbox/philikon/mkzopeapp/trunk/setup.py
===================================================================
--- Sandbox/philikon/mkzopeapp/trunk/setup.py	                        (rev 0)
+++ Sandbox/philikon/mkzopeapp/trunk/setup.py	2007-07-06 14:55:39 UTC (rev 77517)
@@ -0,0 +1,24 @@
+from setuptools import setup, find_packages
+
+setup(
+    name='mkzopeapp',
+    version='0.1',
+    author='Philipp von Weitershausen',
+    author_email='philipp at weitershausen.de',
+    url='http://zope.org',
+    download_url='svn://svn.zope.org/repos/main/Sandbox/philikon/mkzopeapp/trunk#egg=mkzopeapp-dev',
+    description='Setup script for a Zope application',
+    long_description=open('README.txt').read(),
+    license='ZPL',
+
+    packages=find_packages(),
+    include_package_data=True,
+    zip_safe=False,
+    install_requires=['PasteScript>=1.3',],
+    entry_points="""
+    [console_scripts]
+    mkzopeapp = mkzopeapp:main
+    [paste.paster_create_template]
+    zope_app = mkzopeapp:ZopeApp
+    """,
+)


Property changes on: Sandbox/philikon/mkzopeapp/trunk/setup.py
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list