Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
cb7bf45
Retire db.sqlite3 du repo, désormais ignoré
Medspyas May 15, 2025
4a43979
Recupèration du projet et première restructuration des modèles, templ…
Medspyas May 15, 2025
d2ac29f
Ajout de test unitaire, de page personnalisé des erreurs 404 ou 500, …
Medspyas May 19, 2025
66b6f6d
Ajout des docstrings et inialisation de sentry ainsi qu'intégration d…
Medspyas May 20, 2025
08fa178
Retrait du fichier .coverage du dépôt et ajout au .gitignore
Medspyas May 23, 2025
5636760
Initialisation de docker avec l'implémentation du dockerfile et du do…
Medspyas May 23, 2025
990a507
Ajout du fichier CI pipeline pour l'automatisation des test, et pour …
Medspyas May 27, 2025
5e82780
Ajout de secret_key dans le pipeline CI
Medspyas May 27, 2025
8ce6296
Ajout des variables envs dans le dockerfile et le build docker du CI …
Medspyas May 27, 2025
0544fcc
Modifications syntaxe dockerfile
Medspyas May 27, 2025
a696333
Fix
Medspyas May 27, 2025
7d8fb2f
Modification structure CI pipeline et Dockerfile
Medspyas May 27, 2025
cc5d9fd
Fix syntaxe
Medspyas May 27, 2025
e0c8542
Fix syntaxe
Medspyas May 27, 2025
d71b5d7
Isolation des variables env de l'image docker
Medspyas May 28, 2025
c668d61
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
b762b3e
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
70785b2
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
b936cfe
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
ede48e7
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
83f5747
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
937a8b7
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
5e7b984
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
46648c9
[DEBUG]Isolation des variables env de l'image docker
Medspyas May 28, 2025
3431f63
[FIX]Isolation des variables env de l'image docker
Medspyas May 28, 2025
3760c60
MAJ fichier requirements.txt
Medspyas May 29, 2025
49e498b
MAJ hôte de l'application
Medspyas May 29, 2025
f20ee9f
MAJ hôte de l'application
Medspyas May 29, 2025
0f2ec21
Changement du collectstatic dans le dockerfile au lieu du .yml
Medspyas May 29, 2025
744b622
FIX: collectstatic en production
Medspyas May 30, 2025
bebe7a4
FIX: collectstatic en production
Medspyas May 30, 2025
6430861
FIX: collectstatic en production
Medspyas May 30, 2025
a53aa0b
DEBUG: collectstatic en production
Medspyas May 30, 2025
40a309d
FIX: collectstatic en production
Medspyas May 30, 2025
43e388b
Ajout de la base de donnée pour le déploiement
Medspyas May 30, 2025
54a1ab6
Déplacement des objets profiles et lettinsg dans leur admins respectif
Medspyas Jun 2, 2025
1aaa214
Déplacement des objets profiles et lettinsg dans leur admins respectif
Medspyas Jun 2, 2025
18f3ea3
Ajout du fichier yml de readthedoc pour la documentation
Medspyas Jun 2, 2025
d35a11a
Complément de la documentation
Medspyas Jun 2, 2025
98517cc
Modification chemin conf.py
Medspyas Jun 2, 2025
f677f5e
Modification chemin conf.py
Medspyas Jun 2, 2025
4ceb599
Modification chemin conf.py
Medspyas Jun 2, 2025
bbd7963
Modification chemin conf.py
Medspyas Jun 2, 2025
c7ad708
Modification chemin conf.py
Medspyas Jun 2, 2025
0dcc3e2
Modification chemin conf.py
Medspyas Jun 2, 2025
a998f7b
Modification chemin conf.py
Medspyas Jun 2, 2025
883a610
Déplace conf.py de docs/source/ vers docs/
Medspyas Jun 2, 2025
0a20a31
Fix: chemin conf.py
Medspyas Jun 2, 2025
488287d
Fix: chemin conf.py
Medspyas Jun 2, 2025
4471110
Fix: chemin conf.py
Medspyas Jun 2, 2025
abc78f4
Fix: chemin conf.py
Medspyas Jun 2, 2025
50addf8
Fix: chemin conf.py
Medspyas Jun 2, 2025
06022b0
Fix: chemin conf.py
Medspyas Jun 2, 2025
6ee7a1c
Fix: chemin conf.py
Medspyas Jun 2, 2025
64ad5c9
Fix: chemin conf.py
Medspyas Jun 2, 2025
cfa8fa5
Fix: récuperation objets profiles et lettings
Medspyas Jun 2, 2025
d30f0db
Fix: récuperation objets profiles et lettings
Medspyas Jun 2, 2025
606aa02
Mise à jour du fichier et README
Medspyas Jun 26, 2025
1b2b290
[Test]Modification Titre de la page d'acceuil
Medspyas Jun 28, 2025
b8691ca
Modification du titre de la page d'acceuil
Medspyas Jun 28, 2025
68ad9c4
Automatisation de deploiement render dans le pipeline CI/CD
Medspyas Jun 28, 2025
ee11ddf
Automatisation de deploiement render dans le pipeline CI/CD
Medspyas Jun 29, 2025
57bfedd
[Test] Modification titre page d'acceuil
Medspyas Jun 29, 2025
6a00550
[Test] Modification titre page d'acceuil
Medspyas Jun 29, 2025
8cfd5c5
[Test] Modification titre page d'acceuil
Medspyas Jun 29, 2025
d0af348
[Test] Modification titre page d'acceuil
Medspyas Jun 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**/__pycache__
*.pyc
venv
.venv
.pytest_cache
.git
.gitignore
.coverage
staticfiles/
oc_lettings_site\storage.py
63 changes: 63 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI pipeline

on:
push:
branches :
- feature/refactor-apps
pull_request:
branches :
- feature/refactor-apps


jobs:
test-lint-build:
runs-on: ubuntu-latest

env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
SENTRY_KEY: ${{ secrets.SENTRY_KEY }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8 pytest

- name: Lint with flake8
run: |
echo "Running flake8 with setup.cfg"
flake8 .

- name: Run tests with pytest
run: |
echo "Running tests ..."
pytest


- name: Docker login
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest

- name: Trigger Render Deploy Hook
run: curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
**/__pycache__
*.pyc
venv
.venv
.pytest_cache
.env
.coverage
staticfiles/
build/
25 changes: 25 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version, and other tools you might need
build:
os: ubuntu-24.04
tools:
python: "3.11"


# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py
builder: html


# Optionally, but recommended,
# declare the Python requirements required to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: requirements.txt
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM python:3.11-slim


ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1\
DEBUG=False \
DJANGO_SETTINGS_MODULE=oc_lettings_site.settings


ARG SECRET_KEY=xtokenforbuildonly
ENV SECRET_KEY=${SECRET_KEY}

WORKDIR /app

COPY . /app/


RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir -r requirements.txt

RUN python manage.py collectstatic --noinput

EXPOSE 8000

CMD ["gunicorn", "oc_lettings_site.wsgi:application", "--bind", "0.0.0.0:8000"]
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,81 @@ Utilisation de PowerShell, comme ci-dessus sauf :

- Pour activer l'environnement virtuel, `.\venv\Scripts\Activate.ps1`
- Remplacer `which <my-command>` par `(Get-Command <my-command>).Path`

### Fichier .env
Le projet utilise un fichier `.env` pour centraliser les variables d'environnement sensibles.

Créez un fichier `.env` à la racine du projet avec comme variable:
- SECRET_KEY
- SENTRY_DSN
- SECRET_DEPLOY_HOOK

Ne pas commit ce fichier dans Git, il doit être listé dans le `.gitignore`


### Docker

L'application dispose d'un `Dockerfile` pour créer une image Docker exécutable:
commande pour la création de l'image `docker build -t oc-lettings .`

Pour la partie CI/CD:
- Créer un compte docker sur Docker Hub (https://hub.docker.com/)
- Configurer vos identifiants dans les **secrets GitHub**:
- `DOCKER_USERNAME`
- `DOCKER_PASSWORD`(sous forme de token)

### CI/CD:

Un pipeline GitHub a été ajouté, déclenché à chaque push.
Il execute automatiquement les étapes suivantes:

- Lint avec `flake8`
- Tests unitaires avec `pytest`
- Build Docker
- Push vers Docker Hub
- Génération de la documentation


### Documentation

La documentation technique est générée avec **Sphinx** et hebergée sur **Read the Docs**:

Créer sa propre doc

1. Créer un compte sur https://readthedocs.org
2. Connecter votre repo GitHub
3. Importer le projet
4. S'assurer que `.readthedocs.yml` est présent à la racine
5. Déclencher un build

### Sentry

Étapes pour intégrer Sentry:

1. Créer un compte sur https://sentry.io
2. Créer un projet Django
3. Copier la clé DSN dans votre environnement de variable (.env)
4. Ajouter le bloc de code de sentry générée dans sentry et la Clé DSN dans `oc_lettings_site/settings.py`


### Déploiement

Render est connecté à Docker Hub pour tirer l'image automatiquement.

**Étapes pour configurer**

1. Créer un compte render (https://render.com)
2. Créer un Web service
3. Indiquer l'image Docker :
```
docker.io/nom utilisateur/nom de l'application

```
4. Déploiement automatique à chaque image pushée

Exemple de lien de production :
https://oc-lettings.onrender.com




20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
44 changes: 44 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import os
import sys

import django

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

sys.path.insert(0, os.path.abspath("../.."))

os.environ["DJANGO_SETTINGS_MODULE"] = "docs.source.doc_settings"


django.setup()

project = "oc-lettings"
copyright = "2025, mehdi"
author = "mehdi"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
]

templates_path = ["_templates"]
exclude_patterns = []

language = "fr"
local_dirs = ["locales/"]
gettex_compact = False

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
18 changes: 18 additions & 0 deletions docs/source/doc_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SECRET_KEY = "clef_secrète_pour_la_doc"


INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"oc_lettings_site",
"lettings",
"profiles",
]


DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
19 changes: 19 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. oc-lettings documentation master file, created by
sphinx-quickstart on Fri May 30 13:39:36 2025.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

oc-lettings documentation
=========================

Add your content using ``reStructuredText`` syntax. See the
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
documentation for details.


.. toctree::
:maxdepth: 2
:caption: Contents:

presentation
modules
16 changes: 16 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Documentation des modules
=========================


.. automodule:: lettings.models
:members:


.. automodule:: lettings.views
:members:

.. automodule:: profiles.models
:members:

.. automodule:: profiles.views
:members:
11 changes: 11 additions & 0 deletions docs/source/presentation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Présentation du projet
======================



Ce projet est un site Django qui permet de gérer des annonces de locations et des profils utilisateurs.

Fonctionalités :
- Navigation des profils
- Liste des locations
- Accés à l'administraiion du site via Django admin
Empty file added lettings/__init__.py
Empty file.
Loading