|
|
||
|---|---|---|
| .forgejo/workflows | ||
| allauth_oauth | ||
| docs | ||
| photo21 | ||
| photologue | ||
| Scripts | ||
| .env.example | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| Cold_Backup.md | ||
| COPYING | ||
| docker-compose.yml | ||
| Dockerfile | ||
| entrypoint.sh | ||
| maintenance_tool.sh | ||
| manage.py | ||
| README.md | ||
| requirements.txt | ||
| tox.ini | ||
Photo server
This is the source code for the webserver hosting pictures from the ENS Rennes student life.
The philosophy of this project is to keep this code as simple as possible to run and to maintain.
This project is a fork of Photo21, originally developed at ENS Paris-Saclay.
Docker install (recommended for production)
-
Create a
docker-compose.yml(a ready-to-use file is provided in the repository):version: "3.9" networks: photo26: services: db: image: postgres:16 container_name: photo26-db restart: unless-stopped environment: POSTGRES_DB: photo26 POSTGRES_USER: photo26 POSTGRES_PASSWORD: change-me volumes: - ./postgres_data:/var/lib/postgresql/data networks: - photo26 photo26: image: git.sinfonie.org/sinfonie/photo26:latest container_name: photo26-app restart: unless-stopped depends_on: - db environment: DB_ENGINE: postgres DB_NAME: photo26 DB_USER: photo26 DB_PASSWORD: change-me DB_HOST: db DB_PORT: 5432 SECRET_KEY: change-me EXTRA_HOSTS: photos.example.org volumes: - ./media:/app/media ports: - "8080:8000" networks: - photo26 -
Start the stack:
docker compose up -dOn first start the container will run migrations and create a default admin account automatically.
-
Default credentials — change these immediately after first login:
Field Value Username adminPassword adminEmail admin@localhostAdmin panel:
http://localhost:8080/admin/ -
Passwords to change in
docker-compose.ymlbefore going to production:POSTGRES_PASSWORD/DB_PASSWORD— database passwordSECRET_KEY— Django secret key (use a long random string)- Log in to the admin panel and change the
adminuser password
Development setup
-
Cloning. Change directory to where you want the project to be.
git clone https://codeberg.org/krek0/photo21.git && cd photo21 -
Dependency installation. If you are not using Debian, please feel free to adapt the following instructions.
sudo apt install git gettext python3-django python3-django-allauth python3-django-crispy-forms python3-docutils python3-exifread python3-pil -
Configuration.
sudo mkdir static media sudo chmod +x maintenance_tool.sh -
Database. In development, you may use SQLite (no setup). In production, we use PostgreSQL which require a bit of setup:
sudo apt install postgresql postgresql-contrib sudo -u postgres psql postgres=# CREATE USER photo21 WITH PASSWORD 'your_password'; postgres=# CREATE DATABASE photo21 OWNER photo21; -
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 -
Maintenance Mode. In production to toggle the server maintenance mode
./maintenance_tool.sh -
Enjoy \o/
(env)$ ./manage.py runserver