No description
  • JavaScript 66.9%
  • Python 28.1%
  • HTML 3.5%
  • Shell 1.5%
Find a file
2026-03-11 13:07:15 +01:00
assets/images/app Add UI images 2026-03-03 10:28:41 +01:00
fronttheque feat: add another image placeholder 2026-03-11 13:07:15 +01:00
src fix: more loan cookie issues 2026-03-11 12:59:15 +01:00
.env.example Add project files 2026-03-03 09:52:51 +01:00
.gitignore Ignore dist, staticfiles and media 2026-03-03 10:18:38 +01:00
.pre-commit-config.yaml Add pre-commit and pytest 2026-03-03 10:57:50 +01:00
.project Add project files 2026-03-03 09:52:51 +01:00
.pydevproject Add project files 2026-03-03 09:52:51 +01:00
deploy.sh chore: move code under src and rename MatosthequeRestApis->project, Matostheque->matostheque (update imports) 2026-03-03 10:51:51 +01:00
gunicorn_config.py Edit gunicorn_config.py 2026-03-03 14:47:33 +01:00
LICENSE.md Add project files 2026-03-03 09:52:51 +01:00
package-lock.json Add project files 2026-03-03 09:52:51 +01:00
package.json Add project files 2026-03-03 09:52:51 +01:00
pdm.lock Add pre-commit and pytest 2026-03-03 10:57:50 +01:00
pyproject.toml Add pre-commit and pytest 2026-03-03 10:57:50 +01:00
README.md Edit README.md 2026-03-03 14:49:34 +01:00

Matostheque

Matostheque is a full-stack application with:

  • a Django backend in src/
  • a Next.js frontend in fronttheque/

Overview

  • Backend configuration is driven by environment variables loaded from .env (python-dotenv).
  • PostgreSQL is expected as the database.
  • Frontend build artifacts are integrated into Django static files via STATICFILES_DIRS.

See src/project/settings.py for backend settings details.

Requirements

  • Git
  • Python 3
  • PostgreSQL
  • Node.js LTS and npm (or yarn)

Quick Start (Development)

1) Clone the repository

git clone https://gitlab.in2p3.fr/vikhram-kofi.duffour/matostheque.git matostheque_app
cd matostheque_app

2) Set up the backend (Django)

Create and activate a virtual environment (or use pdm directly):

python3 -m venv .venv
source .venv/bin/activate

Install Python dependencies:

pip install .
# or
pdm install

Create and edit your environment file:

cp .env.example .env

Fill in at least: DB_NAME, DB_USER, DB_PASSWORD, EMAIL_HOST_USER, SECRET_KEY, etc.

Generate a Django SECRET_KEY (optional):

python - <<'PY'
from django.core.management.utils import get_random_secret_key
print(get_random_secret_key())
PY

3) Set up the frontend (Next.js)

cd fronttheque
npm install
npm run dev

4) Configure PostgreSQL

Example setup (from deploy.sh, Linux/Ubuntu style):

sudo apt update
sudo apt install postgresql postgresql-contrib

sudo -u -i postgres 
psql
CREATE DATABASE matostheque;
CREATE USER your_database_username WITH ENCRYPTED PASSWORD 'your_database_password';
GRANT ALL PRIVILEGES ON DATABASE matostheque TO your_database_username;
ALTER DATABASE matostheque OWNER TO your_database_username;
\q

Ensure .env values match your PostgreSQL database/user/password.

5) Run migrations and start Django

cd src
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

Optional shortcut:

pdm manage

Local URLs

  • Frontend: http://localhost:3000
  • Django admin: http://localhost:8000/admin

Production Build and Deployment Notes

Frontend production build

cd fronttheque
NODE_ENV=production npm run build
NODE_ENV=production npm run start

Backend production (Gunicorn)

gunicorn_config.py and deploy.sh provide deployment references.

Quick start example (adapt paths/user first):

nohup gunicorn -c gunicorn_config.py project.wsgi &

deploy.sh also contains example systemd services:

  • matostheque-backend.service
  • matostheque-frontend.service

Before enabling them, update WorkingDirectory, ExecStart, User, and Group.

Static Files and Media

  • Django collects frontend build artifacts through STATICFILES_DIRS.
  • Check src/project/settings.py for paths such as fronttheque/.next/static and dist.

For production static collection:

python src/manage.py collectstatic --noinput --clear