---
myst:
  html_meta:
    "description": "Install the collective.polls backend in a Plone 6.2 project and verify the result."
    "property=og:description": "Install the collective.polls backend in a Plone 6.2 project and verify the result."
    "property=og:title": "Install the backend"
    "keywords": "Plone, polls, install, backend, uv, GenericSetup"
---

(how-to-install-backend)=

# Install the backend

Install `collective.polls` in a Plone site and confirm it works.

This guide covers the backend only.
The frontend is a separate package and a separate guide: {doc}`frontend`.

## Requirements

| | |
|---|---|
| Plone | 6.2 |
| Python | {SUPPORTED_PYTHON_VERSIONS} |
| Frontend | Volto 19. Polls have no Classic UI. |

## Install the backend

These steps are for a project generated by [Cookieplone](https://github.com/plone/cookieplone), which is the layout a Plone 6 project has.
Paths are relative to `backend/`, and `<yourpackage>` is the package under `src/`.

1.  Declare the dependency in `pyproject.toml`.

    ```toml
    dependencies = [
        "Products.CMFPlone",
        "plone.api",
        "plone.restapi",
        "plone.volto",
        "collective.polls",
    ]
    ```

2.  Load its ZCML, in `src/<yourpackage>/dependencies.zcml`.

    ```xml
    <configure xmlns="http://namespaces.zope.org/zope">

      <include package="collective.polls" />

    </configure>
    ```

    Your package's `configure.zcml` already pulls that file in with `<include file="dependencies.zcml" />`.
    Installing the distribution is not enough on its own: without the `include`, nothing registers, and the add-on does not appear in the control panel.

3.  Install it with your own package, in `src/<yourpackage>/profiles/default/metadata.xml`.

    ```xml
    <?xml version="1.0" encoding="utf-8"?>
    <metadata>
      <version>1000</version>
      <dependencies>
        <dependency>profile-collective.polls:default</dependency>
      </dependencies>
    </metadata>
    ```

    Naming it here is what makes a fresh site arrive with polls, rather than waiting for somebody to remember the add-ons control panel.
    The profile depends on `plone.volto:default`, and installs it when the site does not have it yet.

4.  Install the new dependencies, then restart the Plone instance.

    ```shell
    make backend-install
    make backend-start
    ```

    This is a ZCML change, so the site does not see the add-on until it restarts.

```{note}
To install into a site that already exists, without touching your package, use the **Add-ons** control panel, where the add-on is listed as **collective.polls**, and choose **Install**.
```

## Verify

A working install has all of these.

-   **collective.polls** under **Installed** in the **Add-ons** control panel.
-   **Poll** in the **Add** menu of a folderish page.
-   An answer from the `@poll` service on any poll, with `GET <poll-url>/@poll`.

The service answers `404 Not Found` when the profile was not applied, because the services exist only with the add-on's browser layer.

## Uninstalling

Uninstalling removes the browser layer, which removes the `@poll` and `@vote` services.
It leaves every poll and its votes in place.

## Next steps

1.  {doc}`frontend`: the Volto add-on, without which polls cannot be shown or voted on.
2.  {doc}`/tutorials/first-poll`: create, open, and close a poll.
