Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5573 volto core python #6380

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 31 additions & 30 deletions docs/source/contributing/developing-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Volto has the following folder structure.
```


## Development prerequisites
## Development pre-requisites

To set up a Volto core development environment, your system must satisfy the following prerequisites.
To set up a Volto core development environment, your system must satisfy the following pre-requisites.

```{include} ./install-operating-system.md
```
Expand Down Expand Up @@ -183,7 +183,8 @@ To stop either the backend or frontend, use {kbd}`ctrl-c`.

### Start the backend

`````{versionadded} 18.0.0-alpha.42
#### Option 1: Using Docker (Recommended)

Persist backend data across Docker sessions.

````{warning}
Expand All @@ -194,51 +195,51 @@ It is intended only for development.
{doc}`../deploying/index`
```
````
`````

In the first session, start the backend.
In the first session, start the backend using Docker.
You can browse to the backend running at http://localhost:8080.

```shell
make backend-docker-start
```
````shell
pip install -r requirements.txt
make start-backend
````

When you run this command for the first time, it will download Docker images, configure the backend, create a Docker volume to persist the data named `volto-backend-data`, and start the backend.

Subsequently, when you run `make backend-docker-start`, it will only start the backend using the existing configuration and Docker image and volume.
Subsequently, when you run `make start-backend`, it will only start the backend using the existing configuration and Docker image and volume.

````{note}
If you would like to start the backend with a clean data volume, you can run the following command.
#### Option 2: Using Python directly

```shell
docker volume rm volto-backend-data
```
If you prefer not to use Docker, you can run the backend directly with Python:

Then run `make backend-docker-start` again to start the backend with a clean data volume.
1. Create a virtual environment:
````shell
python -m venv venv
source venv/bin/activate
````

2. Install dependencies:
````shell
pip install -r requirements-docs.txt
````

(develop-volto-configure-backend-language-label)=

#### Configure backend language

If you use the Docker image [`plone-backend`](https://github.com/plone/plone-backend), you can set its `LANGUAGE` environment variable, overriding the default of `en`, when you start it.
3. Start the backend:
````shell
make start-backend-py
````

This variable is applied only when the Plone site is created.
If you persist data through restarts, you only need to do this once.
Conversely, if you create a Plone site in the wrong language, you can delete the data volume, and recreate it with the correct language.
The backend will be available at http://localhost:8080.

You can either pass an environment variable into the make command to start the backend, or export an environment variable in your shell session and start the backend.
````{note}
For both options, if you would like to start the backend with a clean data volume, you can run:

```shell
# pass method
LANGUAGE=pt-br make backend-docker-start

# export method
export LANGUAGE=pt-br
make backend-docker-start
make stop-backend
```

Then run `make start-backend` (for Docker) or `make start-backend-py` (for Python) again to start the backend with a clean slate.
````


(develop-volto-start-the-frontend-label)=

Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/5573.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added Python-based backend alternative to Volto development documentation
Loading