[Grok-dev] bypass UI adding application to grok AND multiple applications under /src howto?

Christian Klinger goschtl at googlemail.com
Sat Jan 14 08:17:55 UTC 2012


Christian Schmidt schrieb:
> Hi there,
> We are testing if grok is the solution for us to develop our new user
> interface. We are discussing and testing the grok framework consulting
> the grok tutorial and the book of Carlos de la Guardia - Grok 1.0 Web
> Development.
> One of our programmers has the opinion that it would be hard to place it
> under version control - referring
> http://grok.zope.org/documentation/how-to/placing-your-grok-project-under-version-control.
> Problem is - he is thinking - the data.fs ZODB. But, we don't save
> userdata there - all data will be stored with sqlalchemy under postgres.
> So there would be clean rebuild for any new installation if data.fs does
> not exists. But, is there a way to bypass adding the application name
> into the Grok UI? - I have googled that, but found nothing.
> The idea is, that we download our application from svn or git, make a
> python bootstrap.py and bin/buildout and all works out of the box - on
> every developers local box or production server. - no application name
> UI adding.

You can do this easily with zope.generations. There is an howto
for using it. You can find it here.


I guess you have to add a missing zcml statement in configure.zcml

<include package="zope.generations" file="subscriptions.zcml"/>

> Our further goal is to manage different things. We need something like
> this:
> http://EXAMPLE.com/customers/show | edit | etc.
> http://EXAMPLE.com/mailadmin/
> http://EXAMPLE.com/mailadmin/domains
> http://EXAMPLE.com/mailadmin/domains/add
> http://EXAMPLE.com/mailadmin/domains/delete
> http://EXAMPLE.com/mailadmin/domains/useraccount/add
> http://EXAMPLE.com/mailadmin/domains/useraccount/list
> http://EXAMPLE.com/mailadmin/domains/useraccount/delete
> Do we need to create multiple applications under src/? - what would be
> the right way?
> My Idea was:
> [localpy] %grokproject myproject
> [localpy] %cd myproject/
> [localpy] %python bootstrap.py
> [localpy] %bin/buildout
> creates myproject with the default structure.
> [localpy] %ls src/
> myproject/src/__init__.py
> myproject/src/app_templates
> myproject/src/resource.py
> myproject/src/tests
> myproject/src/app.py
> myproject/src/configure.zcml
> myproject/src/static
> [localpy] %bin/paster serve parts/etc/debug.ini
> Starting the Server the UI shows no application:
> "Currently no working applications are installed."
> To enable the default application "myproject" I have to add the
> application to grok. The only way I know is to add this unter der Server
> UI.

You can use zope.generations as mentioned on top of the response.

> If I want now create an other application under src. How would I do
> that? I want to have ie:
> mailadmin/src/__init__.py
> mailadmin/src/app_templates
> mailadmin/src/resource.py
> mailadmin/src/tests
> mailadmin/src/app.py
> mailadmin/src/configure.zcml
> mailadmin/src/static
> My Idea was to copy all files from myproject to mailadmin and change the
> template. Is there a paster - template available for that job? (creating
> a grok sub-application under src)

What i do is to generate a basic python package via paster. I copy this 
new package in src directory of my generated grokproject. This would be
in your case something like:

myproject/src/mailadmin/... <-- This is my generated paster package

Ok now you have to change a line in your buildout.cfg file.

develop = .


develop = . src/mailadmin

rerun bin/buildout. And you can start to add classes to your new 
mailadmin package.

> Adding this mailadmin application to grok whit the UI does not the job,
> because http// shows the template of
> myproject/app_templates/index.pt not mailadmin/app_templates/index.pt.
> How to add mailadmin to the grok application, enable the application so
> my request for http// shows
> mailadmin/app_templates/index.pt. Do I have to add it to any configfile
> as well?
> I found that this should be possible, but not how in detail:
> https://mail.zope.org/pipermail/grok-dev/2010-August/010542.html
> I hope that i have written all detailed enough an think that many other
> have the same problems in understanding grok and I would be glad, if
> someone helps me to take the first cliffs.

BTW you can join the grok-irc channel. Sometimes you get really fast 
help from there.

If you have further questions, please let me know.


> Kind regards
> Christian

More information about the Grok-dev mailing list