mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-04-29 18:32:38 +02:00
126 lines
2.8 KiB
Markdown
126 lines
2.8 KiB
Markdown
First, clone the project
|
|
|
|
```bash
|
|
git clone git@gitlab.com: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:
|
|
|
|
```bash
|
|
python3 -m venv .venv
|
|
```
|
|
|
|
Once the virtual environment is installed, you can activate it:
|
|
|
|
```bash
|
|
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:
|
|
|
|
```bash
|
|
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](https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstart)).
|
|
|
|
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:
|
|
|
|
```sql
|
|
CREATE ROLE chariotte WITH
|
|
LOGIN
|
|
NOSUPERUSER
|
|
CREATEDB
|
|
NOCREATEROLE
|
|
INHERIT
|
|
NOREPLICATION
|
|
CONNECTION LIMIT -1
|
|
PASSWORD 'xxxxxx';
|
|
```
|
|
```sql
|
|
CREATE DATABASE chariotte
|
|
WITH
|
|
OWNER = chariotte
|
|
ENCODING = 'UTF8'
|
|
CONNECTION LIMIT = -1
|
|
IS_TEMPLATE = False;
|
|
```
|
|
|
|
## Create a configuration file
|
|
|
|
Create a local configuration file:
|
|
|
|
```python title="local_settings.py"
|
|
from la_chariotte.settings import *
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.postgresql",
|
|
"NAME": "chariotte",
|
|
"USER": "chariotte",
|
|
"PASSWORD": "chariotte",
|
|
"HOST": "localhost",
|
|
}
|
|
}
|
|
```
|
|
|
|
## Compile the CSS files
|
|
|
|
We use bulma as a CSS framework.
|
|
|
|
Make sure you are using the correct version of sass:
|
|
|
|
```bash
|
|
sass --version
|
|
# used for development: 1.59.3 compiled with dart2js 2.19.4
|
|
```
|
|
|
|
Recompile as soon as changes are detected in scss files.
|
|
|
|
```bash
|
|
sass --watch --no-source-map ./la_chariotte/static/sass/style.sass:./la_chariotte/static/css/app.css
|
|
```
|
|
|
|
Or prefer to compile to CSS on a per-occurrence basis:
|
|
```bash
|
|
sass --no-source-map ./la_chariotte/static/sass/style.sass:./la_chariotte/static/css/app.css
|
|
```
|
|
|
|
## Start the server
|
|
|
|
Everything should now be ready to start the server:
|
|
|
|
```shell
|
|
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):
|
|
```shell
|
|
python manage.py createsuperuser
|
|
```
|