This package allows you to run grok without the zodb
Project description
The main purpose of this package is to provide support for enabling Grok applications to be run as aster served WSGI applications without using the zodb.
Using megrok.nozodb
To setup a grok environment which works without the zodb you have to replace the paster-application-factory which typically is located in the debug.ini and in the deploy.ini: To be concrete replace grokcore.startup#… with megrok.nozodb#nozodb
[app:grok] use = egg:megrok.nozodb#nozodb
The next you have to do is setting up global utility which acts as an ApplicationRoot which is a starting point for your application. megrok.nozodb has an ungrokked default one. You can subclass from it or provide your own stuff which acts as ApplicationRoot.:
>>> from megrok.nozodb import ApplicationRoot >>> class MyApplicationRoot(ApplicationRoot): ... pass >>> myapp = MyApplicationRoot() >>> from zope.site.interfaces import IRootFolder >>> IRootFolder.providedBy(myapp) True >>> from grok.interfaces import IApplication >>> IApplication.providedBy(myapp) True >>> from zope.location import ILocation >>> ILocation.providedBy(myapp) True >>> from zope.interface.verify import verifyObject >>> from zope.component.interfaces import ISite >>> verifyObject(ISite, myapp) True
API Documentation
We have to create a simple site definition file, which is also quite plain:
>>> import os, tempfile >>> temp_dir = tempfile.mkdtemp() >>> sitezcml = os.path.join(temp_dir, 'site.zcml') >>> open(sitezcml, 'w').write('<configure />') >>> zope_conf = os.path.join(temp_dir, 'zope.conf') >>> open(zope_conf, 'wb').write(''' ... site-definition %s ... ... <zodb> ... </zodb> ... ... <eventlog> ... <logfile> ... path STDOUT ... </logfile> ... </eventlog> ... ''' %sitezcml) >>> from megrok.nozodb import nozodb_factory >>> app_factory = nozodb_factory({'zope_conf': zope_conf}) Clean up the temp_dir >>> import shutil >>> shutil.rmtree(temp_dir)
Changelog
0.1 (2010-11-04)
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file megrok.nozodb-0.1.tar.gz
.
File metadata
- Download URL: megrok.nozodb-0.1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e81f69cf4b1ba17f34ddbcf772cb72ad7267adbc2d41c06115b069014894ab1 |
|
MD5 | 6b9e7f62b10c0d121ac6dcd8973494cb |
|
BLAKE2b-256 | 860588d5e4eb037c6574ae556dd05e7fced7656e95ea668b0a3ff07da73c7da2 |