16 Jan 07:56
Re: bypass UI adding application to grok AND multiple applications under /src howto?
Christian Klinger <goschtl <at> googlemail.com>
2012-01-16 06:56:50 GMT
2012-01-16 06:56:50 GMT
Hi Matt, ok do you have a configure.zcml in your new paster based package? In every case you need it with the following content: <configure xmlns="http://namespaces.zope.org/zope" xmlns:grok="http://namespaces.zope.org/grok"> <include package="grok" /> <grok:grok package="." /> </configure> Be sure that this configure.zcml is picked up on startup. If you now have for example in this package a app.py with the following content: class MyNewApp(grok.Application): pass You should see this new grok application MyNewApp in the grok-admin interface. If you have further questions please ask.... HTH Christian > Matt Rutherford <mailto:matrutherford <at> gmail.com> > 16. Januar 2012 00:58 > Hi Christian. > > I too am looking to create multiple applications under src and I > followed your advice to generate a basic python package using paster, > placed it under src/, changed the buildout.cfg and rebuilt. > > I have placed my new app.py, etc in this package but I am unsure how > to use this new app class to create an application instance on the > grok admin panel UI. When I go to create new app it is always of the > original default project app type. Can you point me in the right > direction? > > cheers > Matt > > > Christian Klinger <mailto:cklinger <at> novareto.de> > 14. Januar 2012 09:17 > Hi > > 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. > > http://grok.zope.org/doc/community/topics/generations.html > > 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/myproject/... > myproject/src/mailadmin/... <-- This is my generated paster package > > Ok now you have to change a line in your buildout.cfg file. > > develop = . > > into > > 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//127.0.0.1:8080/mailadmin 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//127.0.0.1:8080/mailadmin 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. > > Chrisitan > > >> >> Kind regards >> >> Christian >> >> >>
_______________________________________________ Grok-dev mailing list Grok-dev <at> zope.org https://mail.zope.org/mailman/listinfo/grok-dev
RSS Feed