Attention

This document was written for an old version of Plone, Plone 3, and was last updated 1121 days ago.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Running Plone

by Mikko Ohtamaa last modified Apr 27, 2009 11:31 PM
When you are doing development, you need to restart Plone often to make file changes effective. This can easiest be accomplished by launching Plone directly from Eclipse. Alternatively you can use plone.reload product to make Plone reload only the changed files.

Setting up Plone launcher
-------------------------

Normally one would launch the development Plone instance from the command line using the command::

bin/instance fg

This command executes zope controller (zopectl) which spawns Zope in a separate OS process. This prevents through-the-IDE debugging and stopping the instance. The workaround is to use a custom IDE specific launcher script. I have crafted such a script for Eclipse.

* Download `this file <http://plone.org/documentation/tutorial/developing-plone-with-eclipse/ide-compatible-launcher-script>`_ and place it under bin folder in your Plone instance project, e.g. *instance/bin/idelauncher.py*

* Choose Plone instance project in PyDev explorer.

* Click drop down next to Run button (play arrow) -> Open Run Dialog. Right click Python Run -> New. You need to be in PyDev perspective (Window -> Open perspective) to see the Run button.

- Type in name *Plone instance*

- For the main module choose the downloaded file::

${workspace_loc:YOURPLONEPROJECT}/bin/idelauncher.py

- On Arguments tab, type in the following to base directory::

${workspace_loc:YOURPLONEPROJECT}

- Make sure that Python 2.4 interpreter is chosen

- Eclipse accepts various variable substitutions in the run dialog. If you use ${project_loc}/bin/idelauncher.py syntax to define file locations, relative to the project, the Run icon does not work if you have a wrong project selected when clicking the icon

* Now click Run icon drop down and choose Plone instance

- Plone is started

- All debug messages go to Eclipse console

- You can click tracebacks in Eclipse console to open the related file and location

- You can stop the instance by pressing red stop button in the Eclipse console

Avoiding unnecessary restarts
-----------------------------

Plone automatically reloads all changed \*.pt files and \*.py scripts in skins folders when running Zope in the debug mode. You might also want to disable CSS and Javascript caching in portal_css and portal_javascript tools in ZMI to make the corresponding files reloaded automatically.

Application files, .py modules and .zcml, are not hot startable with the default configuration. Since Plone is a massive application, starting it takes very long time to restart it. `This might frustrate a poor developer <http://diefenba.ch/blog/archive/2008/06/30/quick-tip-8-plone-reload-or-plone-development-is-fun-again>`_. Luckily there is a solution to avoid unnecessary restarts: `plone.reload <http://pypi.python.org/pypi/plone.reload>`_.

1. Add plone.reload egg to your buildout *eggs* directive, *zcml* slugs and rerun buildout

2. Start plone

3. Bookmark url http://localhost:8080/@@reload, the URL which triggers reload, and add it to Firefox bookmark bar to quickly reload only changed Python files.

Killing the ghost instance
--------------------------

If you launch Plone from Eclipse IDE and try to kill it pressing stop, the parent process (zopectl) is killed, but detached Zope launcher is still running on background. You will get "port 8080 reserved" messages when trying relaunch Plone. The solution is to kill running Plone (python2.4) processes using your OS's task manager.


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.