How to get started with Plone development.
Plone is developed in the Python programming language. You should master Python basics before you can efficiently customize Plone. If you are very new to Python, Plone or software development, it is suggested that you read the Professional Plone 4 Development book before you attempt to develop your own solutions.
Plone runs on the top of the Zope 2 application server, meaning that one Zope 2 server process can contain and host several Plone sites. Plone also uses Zope 3 components. Zope 3 is not an upgrade for Zope 2, but a separate project.
Internally, Plone uses the objected-oriented ZODB database and the development mindset greatly differs from that of SQL based systems. SQL backends can still be integrated with Plone, like for any other Python application, but this is a more advanced topic.
A number of Plone trainers have joined forces to create completely open Training materials.
While following a real-life course is the best way to get up to speed with Plone, the material is also very useful for self-study. You will find separate chapters on creating packages, writing your own theme and much more here.
It is recommended that you do Plone development on Linux or OS X. Development on Windows is possible, but you need to have much more experience dealing with Python and Windows related problems, so starting on Windows is not so easy.
See installation instructions for how to create a Plone installation suitable for development.
Non-programming approaches for customizing Plone¶
If you lack programming skill or resources, you can still get some things done in Plone:
- Plomino is a a powerful and flexible web-based application builder for Plone
- PloneFormGen allows you to build forms in a web browser
- Plone comes with through-the-web Dexterity content type editor
Enabling debug mode¶
By default, Plone runs in a production mode where changed files in the file system are not reflected in the served HTML. When you start developing Plone you need to first put it into a debug mode.
Plone add-ons as Python packages¶
Plone sites can be customized by installing Plone add-ons, which add or customize functionality. You can install existing add-ons that others have developed or you can develop and install your own add-ons. Add-ons are developed and distributed as Python packages. Many open-source Python packages, including Plone add-ons, are available from PyPI (the Python Package index).
Plone uses a tool called Buildout to manage the set of Python packages
that are part of your Plone installation.
Using Buildout involves using the
buildout.cfg configuration file and the
Finding and installing add-on packages¶
See the Installing add-on packages using buildout section for more details.
Creating your first add-on¶
Since Python egg package structure is little bit complex, to get started with your first add-on you can create a code skeleton (scaffold) for it using bobtemplates for Plone.
- Mr.Bob with the bobtemplates.plone generates a basic Python egg package with some Plone files in-place.
- This package is registered to buildout as a development egg in the
- Buildout is rerun which regenerates your
bin/instancescript with the new set of Python eggs.
- You start your Plone instance in debug mode.
- You install your add-on through
If you want to create a package with Dexterity content types please read about Setting up a Dexterity project.
Plone development workflow¶
You never edit Plone files directly. Everything under
folders in your Plone installation is downloaded from the Internet and dynamically generated by Buildout,
buildout.cfg. Buildout is free to override these files on any update.
You need to have your own add-on in the
src/ folder as created above.
There you overlay changes to the existing Plone core through extension mechanisms provided by Plone:
Plone development always happens on your local computer or the development server. The changes are moved to production through version control system like Git or Subversion.
The best practice is that you install Plone on your local computer for development.
Plone add-on features¶
Explain that Archetypes are old and basically there to support upgraded sites, but that new development should use Dexterity, maybe remove them even ?
Plone add-ons usually:
- Create custom content types or extend existing ones for your specialized need. Plone has two subsystems for <content types: Dexterity.
- Add new views for your site and its content.
- Create Python-processed forms on your site.
- Theme your site
A lot of Plone functionality is built on Zope 3 development patterns like adapters and interfaces. These design patterns take some time to learn, but they are crucial in complex component based software like Plone.
Development mode restarts¶
Plone must be started in the development mode using
bin/instance fg command. Then
- CSS files are in debug mode and automatically loaded when you hit refresh
- TAL page templates (.pt files) are automatically reloaded on every request
- GenericSetup XML files are reloaded
Please note that Plone development mode does not reload
.zcml files by default.
This is possible, however. Use the sauna.reload package
to make Plone reload your Python code automatically when it is changed.
Some aspects of Plone can be changed through the Zope Management Interface (ZMI). Documentation here does not focus on extending functionality through the ZMI because this method is severely limited and usually can take you only half way there.
Zope 2 book. This describes old Zope 2 technologies. The book is mostly good for explaining some old things, but '''do not''' use it as a reference for building new things.
The chapters on Zope Page Templates however are still the best reference on the topic.
Debug mode explained¶
- Reloading Python code
- Refresh issues
- Starting Plone in debug mode on Microsoft Windows
- Starting Plone in debug mode on UNIX
- Determining programmatically whether Zope is in debug mode