- JavaScript 66.9%
- Python 28.1%
- HTML 3.5%
- Shell 1.5%
| assets/images/app | ||
| fronttheque | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .project | ||
| .pydevproject | ||
| deploy.sh | ||
| gunicorn_config.py | ||
| LICENSE.md | ||
| package-lock.json | ||
| package.json | ||
| pdm.lock | ||
| pyproject.toml | ||
| README.md | ||
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.servicematostheque-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.pyfor paths such asfronttheque/.next/staticanddist.
For production static collection:
python src/manage.py collectstatic --noinput --clear