From the installation directory, run:
cd hanji
./manage.py shell
It is common to access one applet object as imported and instanciated by the server. It can be retrieved using:
from hanji.core import hanjicore
my_applet = hanjicore.applets['my_applet_id']
In Python, the self object as defined above is purely a convention, which allows to write in the shell in the same environment like in the code source:
self = hanjicore.applets['my_applet_id']
The applet’s webUI:
self.webUI
In order to access an applet module definitions:
from hanji.applets.my_applet_id import *
To run a development environment (eg you have a package located in hanji_directory), use the --base-directory option. The --debug flag is also very useful for development, as it gives detailed logs, description of template errors, etc:
twistd --debug -n hanji --base-directory=<hanji_installation_dir> --debug
Allows the Python debugger to be used (works well with ipdb too). To break into the execution, use the usual:
import ipdb;ipdb.set_trace()
Note that you will have to press ‘c’ when the Twisted reactor starts.
Also check the Developing with Eclipse page for running Hanji from Eclipse.
Eclipse with the PyDev extension provides great tools for debugging. See Developing with Eclipse.