Commit 6767bded authored by VAN ZUIJLEN Nils's avatar VAN ZUIJLEN Nils
Browse files

Merge branch '69-documentation' into 'master'

Resolve "Developer Documentation"

See merge request !66
parents e56da3eb 27a415d0
......@@ -4,27 +4,27 @@ url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
django-debug-toolbar = "*"
coverage = "*"
flake8 = "*"
freezegun = "*"
coverage = "*"
mypy = "*"
types-redis = "*"
types-Markdown = "*"
types-requests = "*"
types-freezegun = "*"
types-redis = "*"
types-requests = "*"
[packages]
django = "~=3.2"
django-redis-cache = "*"
redis = "*"
requests = "*"
psycopg2-binary = "*"
Markdown = "*"
Pillow = "*"
beautifulsoup4 = "*"
django = "~=3.2"
django-debug-toolbar = "*"
django-redis-cache = "*"
django-redis-sessions = "*"
django-stubs = "*"
beautifulsoup4 = "*"
psycopg2-binary = "*"
redis = "*"
requests = "*"
[scripts]
......
{
"_meta": {
"hash": {
"sha256": "34335898be1128f863320ec5c6e04344e2dd7070cbf0943754b6d38c966a7f86"
"sha256": "fd8dd7853181a8b76c71a19d6b8f252f525a1638572faf787fec735eb9de081a"
},
"pipfile-spec": 6,
"requires": {},
......@@ -53,6 +53,14 @@
"index": "pypi",
"version": "==3.2.12"
},
"django-debug-toolbar": {
"hashes": [
"sha256:644bbd5c428d3283aa9115722471769cac1bec189edf3a0c855fd8ff870375a9",
"sha256:6b633b6cfee24f232d73569870f19aa86c819d750e7f3e833f2344a9eb4b4409"
],
"index": "pypi",
"version": "==3.2.4"
},
"django-redis-cache": {
"hashes": [
"sha256:a7fbef101a053d2e430bd3befe6a87e6e730f98e335b516f25f30b17d9fe66e3"
......@@ -326,14 +334,6 @@
}
},
"develop": {
"asgiref": {
"hashes": [
"sha256:2f8abc20f7248433085eda803936d98992f1343ddb022065779f37c5da0181d0",
"sha256:88d59c13d634dcffe0510be048210188edd79aeccb6a6c9028cdad6f31d730a9"
],
"markers": "python_version >= '3.7'",
"version": "==3.5.0"
},
"coverage": {
"hashes": [
"sha256:03e2a7826086b91ef345ff18742ee9fc47a6839ccd517061ef8fa1976e652ce9",
......@@ -381,22 +381,6 @@
"index": "pypi",
"version": "==6.3.2"
},
"django": {
"hashes": [
"sha256:9772e6935703e59e993960832d66a614cf0233a1c5123bc6224ecc6ad69e41e2",
"sha256:9b06c289f9ba3a8abea16c9c9505f25107809fb933676f6c891ded270039d965"
],
"index": "pypi",
"version": "==3.2.12"
},
"django-debug-toolbar": {
"hashes": [
"sha256:644bbd5c428d3283aa9115722471769cac1bec189edf3a0c855fd8ff870375a9",
"sha256:6b633b6cfee24f232d73569870f19aa86c819d750e7f3e833f2344a9eb4b4409"
],
"index": "pypi",
"version": "==3.2.4"
},
"flake8": {
"hashes": [
"sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d",
......@@ -488,14 +472,6 @@
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.16.0"
},
"sqlparse": {
"hashes": [
"sha256:0c00730c74263a94e5a9919ade150dfc3b19c574389985446148402998287dae",
"sha256:48719e356bb8b42991bdbb1e8b83223757b93789c00910a616a071910ca4a64d"
],
"markers": "python_version >= '3.5'",
"version": "==0.4.2"
},
"tomli": {
"hashes": [
"sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
......
# Requirements
- A working postgresql setup
- A working redis setup
- python3.7
- A GNU/Linux OS
- python>=3.9 (see Pipfile for up to date info)
## Pipenv
Pipenv is a python virtualenv and dependency manager.
If you do not already have `pipenv` installed:
```sh
# Arch-based linux (Arch, Manjaro, ...)
sudo pacman -S python-pipenv
# Debian-based (Debian, Ubuntu, ...)
sudo apt install pipenv
```
For other distros, see https://pkgs.org/search/?q=pipenv
Or do `pip install --user pipenv`
# Installation
## Database
To create a postgresql database, use:
By default, it uses a sqlite database located in `db.sqlite3` at the repository root and is ignored by git.
You can use [sqlitebrowser](https://pkgs.org/search/?q=sqlitebrowser) to browse its contents in a
graphical interface.
This is not the production setup, so some DB checks may not be done.
As the CI runs with the same engine as production (PostgreSQL), this is not critical if
you do your unit tests right.
## Redis
Unfortunately, a redis server is required even for development purposes.
This may change in the future, allowing for easier dev setup with no caching.
### Arch-based
From https://wiki.archlinux.org/title/Redis#Installation
```sh
sudo pacman -S redis
sudo systemctl enable --now redis.service
```
createdatabase -O dbOwner dbName
### Debian
The following line installs and starts redis
```sh
sudo apt install redis-server
```
### Ubuntu
Follow step 1 from this tutorial: https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04
## CSS compiler
This is only needed if you intend to edit the CSS.
We are using Sass to mimimize the file loads required.
You will need `sassc` to use the provided makefile.
```sh
# Arch-based
sudo pacman -S sassc
# Debian-based
sudo apt install sassc
```
Then, once you have made your edits to the sass files, run `make css` and commit the sass and css.
# Installation
Once you have all requirements, you can run `make install`.
It will install all python dependencies in a venv and migrate the database.
## Venv
If you want to do it manually
```
pipenv sync --dev
```
## Migrations
If you want to do it manually
```
pipenv shell
manage.py migrate
......
......@@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import sys
from typing import List
from typing import Dict, List
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -97,14 +97,10 @@ WSGI_APPLICATION = "site_des_eleves.wsgi.application"
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
DATABASES: Dict[str, Dict[str, object]] = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "sde",
"USER": "root",
"PASSWORD": "",
"HOST": "127.0.0.1",
"PORT": 3306,
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment