[Grok-dev] Re: paster vs grokproject

Martijn Faassen faassen at startifact.com
Wed Jan 30 09:09:06 EST 2008


Tim Terlegård wrote:
[snip]
> As far as I know there's no grokproject switch to create another
> app than the initial one. If I want to add a new app to the project
> I'd do something like:
> 
> $ cd MyProject/src
> $ mkdir newapp
> $ cp initialapp/__init__.py newapp/
> $ cp initialapp/app.py newapp/
> $ cp-r initialapp/app_templates newapp/
> $ cp initialapp/configure.zcml newapp/
> $ cp initialapp/ftesting.zml newapp/
> $ cp initialapp/testing.py newapp/
> $ edit setup.py and buildout.cfg
> 
> Perhaps I misunderstood 'app'. Is there only supposed to be one
> app (grok.Application) on a website?

I'm not sure what you're trying to accomplish here, but to create a new 
application object, I'd just do:

class MyNewApp(grok.Application):
   ...

somewhere in some module.

I don't see a reason to copy ftesting.zcml, testing.py, and so on. I 
also don't see a need to copy setup.py and such. What you seem to be 
describing is a way to organize *two* Python packages (each with an 
application) together. I'm trying to understand why.

> So let's just call it a python package. I may want to split up a website
> in several pckages. If I don't need more than one app.py and one
> app_templates there are still some files left that I have to copy and edit.

I'd make this a completely separate package, with its own setup.py and 
so on, perhaps maintained during development in the same buildout. So:

project/setup.py
project/src/myproject/

and then:

project/anotherproject/setup.py
project/anotherproject/src/anotherproject.py

and list 'anotherproject' in the 'develop' list of my buildout.cfg so 
that its setup.py can be picked up.

I think you could construct 'anotherproject' with grokproject as well 
should you so desire. Of course it's not containing application code 
it'd be nice to be able to construct it with another paster script, one 
that constructs a Python package (with at least a configure.zcml that 
uses the grok command). This is where I'd see paster come in.

Regards,

Martijn



More information about the Grok-dev mailing list