[Grok-dev] Middleware and Grok
faassen at startifact.com
Thu Apr 29 14:14:06 EDT 2010
> This is the code at debug.ini:
> use = egg:grokserver
> filter-with = translogger
> paste.app_factory = zope.paste.application:zope_publisher_app_factory
> pipeline = fileupload main
> paste.filter_factory = FileUploadMedia:make_demo
> #use = egg:gp.fileupload
> tempdir = %(here)s/data/fileupload
> I have some questions:
> Where do I have to store the application in the grok server?
I'm not sure what you mean by 'store the application'. If you're talking
about the implementation of the WSGI app, you can just put it in your
grok project along with the other code. You can then refer to it from
> How can I get the middleware application running?
Hm, this is a rather broad question. :)
> Do I need to create a egg?
If you have code that you'd like to distribute through pypi, then you
could make a .tgz distribution (an actual .egg is not recommended unless
you have C code included, so no for you). If you just want to have code
you distribute internally, you could use:
python setup.py sdist
To make a 'tgz' file in the 'dist' directory of your package. You'll
need to set up a setup.py in that case.
But I don't think there's any need to create an egg to get your
middleware going. You need to implement your middleware in some Python
package or module, and the easiest is in your grok application to get
started. Presumably though you will want to reuse the middleware later
in other applications, and then it's time to make a library and possibly
distribute it to the Python Package index (pypi).
More information about the Grok-dev