Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Create two zope.conf files: A debug and a production one. This will a…
Browse files Browse the repository at this point in the history
…llow you to run grok in a debug and a deploy configuration without re-running bin/buildout or messing around in parts/etc/zope.conf.

Use the fanstatic middleware component that combines the injector and publisher.
  • Loading branch information
janjaapdriessen committed Dec 3, 2010
1 parent b24b672 commit 9ad3789
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 28 deletions.
36 changes: 23 additions & 13 deletions grokproject/template/buildout.cfg_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ unzip = true
parts =
app
daemon
debug_ini
deploy_ini
paster_ini_debug
paster_ini_deploy
i18n
mkdirs
site_zcml
test
zope_conf
zope_conf_debug
zope_conf_deploy
zpasswd
interactive_debugger
# For backward compatibility, telling buildout not to throw away
Expand All @@ -28,12 +29,12 @@ versions = versions
${eggs_dir}
extensions = buildout.dumppickedversions
mr.developer
auto-checkout = hurry.zoperesource
hurry.resource
auto-checkout = fanstatic
zope.fanstatic

[sources]
hurry.resource = svn svn+ssh://svn.zope.org/repos/main/hurry.resource/branches/janjaapdriessen-resource-publisher
hurry.zoperesource = svn svn+ssh://svn.zope.org/repos/main/hurry.zoperesource/branches/janjaapdriessen-wsgi
fanstatic = hg http://bitbucket.org/fanstatic/fanstatic
zope.fanstatic = svn http://svn.zope.org/repos/main/zope.fanstatic/trunk

[versions]
# Override versions here.
Expand All @@ -57,14 +58,14 @@ arguments = serve $${buildout:parts-directory}/etc/deploy.ini
--daemon --pid-file=$${buildout:directory}/var/daemon.pid
--log-file=$${buildout:directory}/log/daemon.log

[debug_ini]
[paster_ini_debug]
recipe = collective.recipe.template
input = etc/debug.ini.in
output = $${buildout:parts-directory}/etc/debug.ini
host = 127.0.0.1
port = 8080

[deploy_ini]
[paster_ini_deploy]
recipe = collective.recipe.template
input = etc/deploy.ini.in
output = $${buildout:parts-directory}/etc/deploy.ini
Expand Down Expand Up @@ -98,15 +99,24 @@ eggs = ${egg}
defaults = ['-v']

[zope_conf]
recipe = collective.recipe.template
input = etc/zope.conf.in
output = $${buildout:parts-directory}/etc/zope.conf
filestorage = $${buildout:directory}/var/filestorage
blobstorage = $${buildout:directory}/var/blobstorage
logfiles = $${buildout:directory}/var/log
# 'extra' is copied verbatim. Use it for product config sections and so.
extra =
devmode on

[zope_conf_debug]
<= zope_conf
recipe = collective.recipe.template
output = $${buildout:parts-directory}/etc/zope.debug.conf
devmode = on

[zope_conf_deploy]
<= zope_conf
recipe = collective.recipe.template
output = $${buildout:parts-directory}/etc/zope.deploy.conf
devmode = off

# This section is named so that the zpasswd utility is
# called `zpasswd`
Expand All @@ -123,7 +133,7 @@ recipe = z3c.recipe.scripts
eggs = ${egg}
entry-points =
interactive_debugger=grokcore.startup.startup:interactive_debug_prompt
arguments = zope_conf="$${zope_conf:output}"
arguments = zope_conf="$${zope_conf_debug:output}"

# The [data] and [log] parts are still in here to instruct buildout to not
# unintentionally throw away the parts/data and parts/log subdirectories
Expand Down
14 changes: 6 additions & 8 deletions grokproject/template/etc/debug.ini.in_tmpl
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
[DEFAULT]
zope_conf = %(here)s/zope.conf
zope_conf = %(here)s/zope.debug.conf

[server:main]
use = egg:Paste#http
host = $${:host}
port = $${:port}

[pipeline:main]
pipeline = accesslogging evalexception resource_publisher resource_injection grok
pipeline = accesslogging evalexception fanstatic grok

[filter:accesslogging]
use = egg:Paste#translogger

[filter:evalexception]
use = egg:z3c.evalexception#ajax

[filter:resource_publisher]
use = egg:hurry.resource#publisher

[filter:resource_injection]
use = egg:hurry.resource#inject
devmode = on
[filter:fanstatic]
use = egg:fanstatic#fanstatic
devmode = $${zope_conf_debug:devmode}
hashing = true

[app:grok]
use = egg:grokcore.startup#debug
Expand Down
16 changes: 9 additions & 7 deletions grokproject/template/etc/deploy.ini.in_tmpl
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
[DEFAULT]
zope_conf = %(here)s/zope.conf
zope_conf = %(here)s/zope.deploy.conf

[server:main]
use = egg:Paste#http
host = $${:host}
port = $${:port}

[pipeline:main]
pipeline = accesslogging gzip resource_publisher resource_injection grok
pipeline = accesslogging gzip fanstatic grok

[filter:accesslogging]
use = egg:Paste#translogger

[filter:gzip]
use = egg:Paste#gzip

[filter:resource_publisher]
use = egg:hurry.resource#publisher

[filter:resource_injection]
use = egg:hurry.resource#inject
[filter:fanstatic]
use = egg:fanstatic#fanstatic
devmode = $${zope_conf_deploy:devmode}
bottom = true
hashing = true
mode = minified
rollup = true

[app:grok]
use = egg:grokcore.startup
Expand Down
2 changes: 2 additions & 0 deletions grokproject/template/etc/zope.conf.in_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ site-definition $${site_zcml:output}
# logfiles are setup in the debug.ini and deploy.ini files.
</eventlog>

devmode $${devmode}

# Extra configuration lines can be added to zope_conf's extra option. Put for
# instance productconf sections in here.
$${zope_conf:extra}

0 comments on commit 9ad3789

Please sign in to comment.