It is customary for any tutorial to contain an obligatory section about how to install the products being documented. Books about tech products likewise follow the same recipe. Rather than duplicate perfectly good material found elsewhere, we shall instead highlight here some of the things which are less obvious to newcomers.
Grok (and the underlying Zope Toolkit libraries) has been ported to Python 3.
Unfortunately, tools used for the original Python-2.7 installation, such as "grokproject" were not ported, due to some dependency issues. This is being addressed.
At this time, there are some options available for a Python 3 development setup, and those are described here.
1. A container based installation is currently available at https://github.com/prsephton/grokserver. One may use this project as a basis for building your own installable container to run your code in a Grok application server. It is surprisingly easy to do this, as demonstrated by the repo for PaintMixer.
2. One may alternately check out the Grok repository directly from github, and work from there.
3. As soon as the dependency issues are sorted, we will take a look at reviving "grokproject".
Rather excellent details on how to go about installing Grok for Python 2 may be found on the getting started page on the main Grok web site.
_________________________________________________________________________________________
It all boils down to:
$ easy_install grokproject
$ grokproject mygrok
Note: at this time, grokproject is broken due to some changes to setuptools. It is still possible to use grokproject, by installing the latest zc.buildout package globally, and then manually running buildout after the automatic run fails. See below.
grokproject currently fails with the error:
"Couldn't find index page for zc.buildout (maybe misspelled?)"At this point, type:
$ cd <the name of the folder grokproject just created, eg "mygrok">
$ pip install zc.buildout
$ buildoutThis will complete the installation process.
________________________________________________________________________________
This will build a directory structure containing a working web server framework and a sample application in mygrok/src/mygrok/app.py
.
Assuming you used mygrok as the name of your grok project, some of the details are not necessarily intuitive to a first time user. The following comments and hints should prevent quite a bit of frustration for newcomers;
bin/paster serve --reload parts/etc/deploy.ini
will start up a server on port 8080 in production modebin/paster serve --reload parts/etc/debug.ini
will start up a server on port 8080 in development modegrok.Application
.zope.app.schema
" in your setup.py immediately when starting out. There is an outstanding problem whereby global utilities (grok.GlobalUtility
) don't register themselves unless this is done.entry_points={
'fanstatic.libraries': [
'mygrok = mygrok.resource:library',
...
]
}
include-site-packages = false
setting which may be set true if you want your local Grok instance to access site-wide packages.~/mygrok/bin/python_console
. This ensures that all of the buildout eggs are available to your IDE so that syntax highlighting and introspection works properly.