Skip to content

c-base/c-base-org-lektor

Repository files navigation

c-base-org-lektor

How to setup the development environment?

(For Windows, see more detailed instructions below)

  • Install uv
  • clone this repository
  • run uv sync --all-extras --dev inside the repository's root folder

Lektor comes with a built-in GUI to edit the site's contents. For this, the development server is needed.

To start the development server:

  • run it directly inside the uv virtual env: uv run lektor server --browse
  • Otherwise you can activate the virtuel env by running poetry shell and then run lektor server.

Install on Windows

https://docs.astral.sh/uv/getting-started/installation/#__tabbed_1_2

The following steps might be necessary on Windows but have not been recently tested:

  • Add the poetry installation directory to the PATH environment variable (German "Umgebungsvariablen"):
    • Add the following entry to %PATH%: %APPDATA%\Python\Scripts
  • Allow the execution of Powershell-Scripts (this is needed to activate the virtualenv) ``Set-ExecutionPolicy -ExecutionPolicy Unrestriced
  • Set the location where virtualenvs will be created to be $project_dir/.venv:
    • poetry config virtualenvs.in-project true
  • Use VS Code to clone the project to a local project directory
  • After cloning, open a new Terminal windows in VSCode and run uv sync --all-extras --dev in the VS Code terminal. That should create the venv.

Create launch.json:

Create a file called .vscode/launch.json in your project directory that contains this:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Module",
            "type": "python",
            "request": "launch",
            "module": "lektor",
            "args": ["server", "--browse"],
            "justMyCode": true
        }
    ]
}

With this you can start and stop the lektor server directly from VSCode's "Run & Debug" menu.