3.1 KiB
First, clone the project
git clone https://framagit.org/la-chariotte/la-chariotte.git
Virtual environment
To prevent the project's necessary libraries from conflicting with those on your system, it may be beneficial to install a virtual environment:
python3 -m venv .venv
Once the virtual environment is installed, you can activate it:
source .venv/bin/activate
Installing the dependencies
!!! info "Weasyprint"
We are using [Weasyprint](https://weasyprint.readthedocs.io/) for `.pdf` generation, which requires certain packages on your machine. You can follow [the instructions on this page](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation) to install them.
Then, you can retrieve the Python dependencies:
pip install -e ".[dev]"
And the frontend dependencies:
=== "Yarn"
```bash
npm install
```
=== "npm"
bash yarn install
Setting up the database
We recommend using PostgreSQL for now (installation instructions here).
For development, we recommend creating a database named chariotte
accessible by the user and password of the same name.
In a PostgreSQL prompt, enter this:
CREATE ROLE chariotte WITH
LOGIN
NOSUPERUSER
CREATEDB
NOCREATEROLE
INHERIT
NOREPLICATION
CONNECTION LIMIT -1
PASSWORD 'xxxxxx';
CREATE DATABASE chariotte
WITH
OWNER = chariotte
ENCODING = 'UTF8'
CONNECTION LIMIT = -1
IS_TEMPLATE = False;
Create a configuration file
Create a local configuration file named "local_settings.py" at the project root :
from la_chariotte.settings import *
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "chariotte",
"USER": "chariotte",
"PASSWORD": "chariotte",
"HOST": "localhost",
}
}
Start the server
Everything should now be ready to start the server:
python manage.py compilescss
python manage.py collectstatic
python manage.py migrate --settings=local_settings
python manage.py runserver --settings=local_settings
To create a superuser, who will have access to the admin interface (/admin):
python manage.py createsuperuser
Working with emails
To test the appearance of emails, you can use Sendria:
pip install sendria
sendria --db mails.sqlite
$NAVIGATOR http://127.0.0.1:1080
Using a custom theme
Themes are provided in the la_chariotte/themes
folder. The default
theme is enabled by default, but the CHARIOTTE_THEME
setting and environment variable allows you to change that. Another light
theme is provided in the repository for you to try, but you can make your own.
After changing the setting or environment variable:
- delete the
static
folder at the repository root - run
python manage.py compilescss
- run
python manage.py collectstatic
- restart the server