update readme

This commit is contained in:
krek0 2026-05-03 18:29:54 +02:00
parent 0e1b1f5a35
commit 429c44d14a

119
README.md
View file

@ -1,72 +1,17 @@
# Photo server 2021-2023 # Photo server
This project is a fork of [Photo21](https://gitlab.crans.org/bde/photo21/) developped at ENS Paris-Saclay.
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.txt) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.txt)
This is the source code for the webserver hosting pictures from the This is the source code for the webserver hosting pictures from the
ENS Paris-Saclay student life. ENS Rennes student life.
The philosophy of this project is to keep this code as simple as possible to The philosophy of this project is to keep this code as simple as possible to
run and to maintain. run and to maintain.
## Setup This project is a fork of [Photo21](https://gitlab.crans.org/bde/photo21/),
originally developed at ENS Paris-Saclay.
1. **Dependency installation.** ## Docker install (recommended for production)
If you are not using Debian, please feel free to adapt the following instructions.
```bash
sudo apt install git gettext python3-django python3-django-allauth python3-django-crispy-forms python3-docutils python3-exifread python3-pil
```
2. **Cloning.**
Change directory to where you want the project to be.
In production, we usually use `/var/www/photos/` as the `root` user.
```bash
git clone https://codeberg.org/krek0/photo21.git && cd photo21
```
3. **Configuration (production only).**
```bash
sudo mkdir static media
sudo chmod +x maintenance_tool.sh
```
4. **Database (production only).**
In development, you may use SQLite (no setup).
In production, we use PostgreSQL which require a bit of setup:
```bash
sudo apt install postgresql postgresql-contrib
sudo -u postgres psql
postgres=# CREATE USER photo21 WITH PASSWORD 'un_mot_de_passe_sur';
postgres=# CREATE DATABASE photo21 OWNER photo21;
```
5. **Initialization.**,
In production, please use `www-data` user.
```
./manage.py collectstatic
./manage.py check
./manage.py migrate
./manage.py compilemessages
# Only when creating a new database
./manage.py loaddata initial
./manage.py createsuperuser
# change DEBUG to True in photo21/settings.py
```
6. **Maintenance Mode.**,
In production to toggle the server mainteance mode
```./maintenance_tool.sh```
## Docker install
1. Create a `docker-compose.yml` (a ready-to-use file is provided in the repository): 1. Create a `docker-compose.yml` (a ready-to-use file is provided in the repository):
@ -136,11 +81,59 @@ run and to maintain.
- `SECRET_KEY` — Django secret key (use a long random string) - `SECRET_KEY` — Django secret key (use a long random string)
- Log in to the admin panel and change the `admin` user password - Log in to the admin panel and change the `admin` user password
--- ## Development setup
6. *Enjoy \o/* 1. **Cloning.**
Change directory to where you want the project to be.
In development, you can launch the development server using: ```bash
git clone https://codeberg.org/krek0/photo21.git && cd photo21
```
2. **Dependency installation.**
If you are not using Debian, please feel free to adapt the following instructions.
```bash
sudo apt install git gettext python3-django python3-django-allauth python3-django-crispy-forms python3-docutils python3-exifread python3-pil
```
3. **Configuration.**
```bash
sudo mkdir static media
sudo chmod +x maintenance_tool.sh
```
4. **Database.**
In development, you may use SQLite (no setup).
In production, we use PostgreSQL which require a bit of setup:
```bash
sudo apt install postgresql postgresql-contrib
sudo -u postgres psql
postgres=# CREATE USER photo21 WITH PASSWORD 'your_password';
postgres=# CREATE DATABASE photo21 OWNER photo21;
```
5. **Initialization.**
```
./manage.py collectstatic
./manage.py check
./manage.py migrate
./manage.py compilemessages
# Only when creating a new database
./manage.py loaddata initial
./manage.py createsuperuser
```
6. **Maintenance Mode.**
In production to toggle the server maintenance mode
```./maintenance_tool.sh```
7. *Enjoy \o/*
```bash ```bash
(env)$ ./manage.py runserver (env)$ ./manage.py runserver