-
Notifications
You must be signed in to change notification settings - Fork 0
Add Sphinx project documentation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,5 @@ | |
| venv | ||
| .env | ||
| .coverage | ||
| htmlcov/ | ||
| htmlcov/ | ||
| docs/build/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| version: 2 | ||
|
|
||
| build: | ||
| os: ubuntu-24.04 | ||
| tools: | ||
| python: "3.7" | ||
|
|
||
| sphinx: | ||
| configuration: docs/source/conf.py | ||
| fail_on_warning: true | ||
|
|
||
| python: | ||
| install: | ||
| - requirements: docs/requirements.txt | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Sphinx==5.3.0 | ||
| sphinx-rtd-theme==1.2.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| Architecture du projet | ||
| ======================= | ||
|
|
||
| Organisation générale | ||
| --------------------- | ||
|
|
||
| Le projet suit une architecture Django modulaire. | ||
|
|
||
| La configuration globale reste dans ``oc_lettings_site`` tandis que les | ||
| fonctionnalités métier sont réparties dans des applications dédiées. | ||
|
|
||
| Structure principale | ||
| -------------------- | ||
|
|
||
| ``oc_lettings_site`` | ||
| Contient la configuration générale du projet Django, les URL principales, | ||
| la page d'accueil et les pages d'erreur personnalisées. | ||
|
|
||
| ``lettings`` | ||
| Gère les adresses et les locations immobilières. | ||
|
|
||
| ``profiles`` | ||
| Gère les profils associés aux utilisateurs Django. | ||
|
|
||
| Répartition des responsabilités | ||
| ------------------------------- | ||
|
|
||
| Chaque application contient ses propres éléments Django : | ||
|
|
||
| * modèles dans ``models.py`` ; | ||
| * vues dans ``views.py`` ; | ||
| * routes dans ``urls.py`` ; | ||
| * tests dans ``tests.py`` ou dans un dossier ``tests`` ; | ||
| * migrations dans le dossier ``migrations`` ; | ||
| * modèles HTML dans le dossier ``templates``. | ||
|
|
||
| Routage des URL | ||
| --------------- | ||
|
|
||
| Le fichier ``oc_lettings_site/urls.py`` centralise les routes principales et | ||
| inclut les routes propres aux applications ``lettings`` et ``profiles``. | ||
|
|
||
| Chaque application possède ainsi son propre fichier ``urls.py`` afin de limiter | ||
| le couplage entre les fonctionnalités. | ||
|
|
||
| Flux d'une requête | ||
| ------------------ | ||
|
|
||
| Lorsqu'un utilisateur accède à une page : | ||
|
|
||
| #. Django analyse l'URL demandée ; | ||
| #. la route correspondante appelle une vue ; | ||
| #. la vue récupère les données nécessaires depuis les modèles ; | ||
| #. la vue transmet ces données à un template ; | ||
| #. Django génère puis retourne la réponse HTML. | ||
|
|
||
| Architecture modulaire | ||
| ---------------------- | ||
|
|
||
| La séparation en applications permet : | ||
|
|
||
| * d'isoler les responsabilités ; | ||
| * de faciliter la maintenance ; | ||
| * de limiter les dépendances entre fonctionnalités ; | ||
| * de simplifier les tests ; | ||
| * de faire évoluer une application sans modifier les autres. | ||
|
|
||
| Migration depuis l'ancienne architecture | ||
| ---------------------------------------- | ||
|
|
||
| Les modèles autrefois regroupés dans ``oc_lettings_site`` ont été déplacés | ||
| dans les applications ``lettings`` et ``profiles``. | ||
|
|
||
| Des migrations de données ont été utilisées pour copier les enregistrements | ||
| existants vers les nouvelles tables tout en conservant leurs identifiants et | ||
| leurs relations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # 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 | ||
|
|
||
| project = 'OC Lettings' | ||
| copyright = '2026, Aurélien Amorin' | ||
| author = 'Aurélien Amorin' | ||
|
|
||
| version = '1.0' | ||
| release = '1.0' | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
|
||
| extensions = [] | ||
|
|
||
| templates_path = ['_templates'] | ||
| exclude_patterns = [] | ||
|
|
||
| language = 'fr' | ||
|
|
||
| # -- 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'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| Base de données et modèles | ||
| =========================== | ||
|
|
||
| Base de données | ||
| --------------- | ||
|
|
||
| Le projet utilise SQLite comme base de données. | ||
|
|
||
| Le fichier principal est situé à la racine du projet : | ||
|
|
||
| ``oc-lettings-site.sqlite3`` | ||
|
|
||
| Django accède aux données par l'intermédiaire de son ORM. Les requêtes SQL | ||
| directes ne sont donc pas nécessaires dans le fonctionnement normal de | ||
| l'application. | ||
|
|
||
| Modèle Address | ||
| -------------- | ||
|
|
||
| Le modèle ``Address`` appartient à l'application ``lettings``. | ||
|
|
||
| Il représente l'adresse d'un bien immobilier et contient les informations | ||
| suivantes : | ||
|
|
||
| * numéro ; | ||
| * rue ; | ||
| * ville ; | ||
| * État ou région ; | ||
| * code postal ; | ||
| * code du pays. | ||
|
|
||
| La table correspondante est : | ||
|
|
||
| ``lettings_address`` | ||
|
|
||
| Modèle Letting | ||
| -------------- | ||
|
|
||
| Le modèle ``Letting`` appartient à l'application ``lettings``. | ||
|
|
||
| Il représente une location et contient : | ||
|
|
||
| * un titre ; | ||
| * une relation vers une adresse. | ||
|
|
||
| Chaque location est associée à une seule adresse au moyen d'une relation | ||
| ``OneToOneField``. | ||
|
|
||
| La table correspondante est : | ||
|
|
||
| ``lettings_letting`` | ||
|
|
||
| Modèle Profile | ||
| -------------- | ||
|
|
||
| Le modèle ``Profile`` appartient à l'application ``profiles``. | ||
|
|
||
| Il complète le modèle utilisateur fourni par Django et contient : | ||
|
|
||
| * une relation vers un utilisateur Django ; | ||
| * une ville favorite. | ||
|
|
||
| Chaque profil est associé à un seul utilisateur au moyen d'une relation | ||
| ``OneToOneField``. | ||
|
|
||
| La table correspondante est : | ||
|
|
||
| ``profiles_profile`` | ||
|
|
||
| Relations principales | ||
| --------------------- | ||
|
|
||
| Les principales relations de données sont les suivantes : | ||
|
|
||
| * un ``Letting`` est lié à un ``Address`` ; | ||
| * un ``Profile`` est lié à un utilisateur Django ; | ||
| * la suppression d'un objet lié entraîne la suppression de l'objet dépendant | ||
| lorsque l'option ``on_delete=models.CASCADE`` est utilisée. | ||
|
|
||
| Migrations | ||
| ---------- | ||
|
|
||
| Les migrations Django décrivent les évolutions successives de la base de | ||
| données. | ||
|
|
||
| Elles sont stockées dans les dossiers suivants : | ||
|
|
||
| * ``lettings/migrations`` ; | ||
| * ``profiles/migrations`` ; | ||
| * ``oc_lettings_site/migrations``. | ||
|
|
||
| Lors de la séparation de l'application monolithique, des migrations de données | ||
| ont copié les anciens enregistrements vers les nouvelles tables. | ||
|
|
||
| Ces migrations ont conservé : | ||
|
|
||
| * les identifiants existants ; | ||
| * les relations entre les locations et les adresses ; | ||
| * les relations entre les profils et les utilisateurs. | ||
|
|
||
| Commandes utiles | ||
| ---------------- | ||
|
|
||
| Afficher l'état des migrations : | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| python manage.py showmigrations | ||
|
|
||
| Créer une migration après une modification de modèle : | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| python manage.py makemigrations | ||
|
|
||
| Appliquer les migrations : | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| python manage.py migrate | ||
|
|
||
| Ouvrir le shell Django pour consulter les données avec l'ORM : | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| python manage.py shell |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 issue (security): Using Python 3.7 on Read the Docs may cause compatibility and security issues.
Since 3.7 is EOL and many tools/dependencies are dropping support for it, it’d be safer to use the same (newer) Python version here as the project’s runtime to avoid subtle behavior differences and future dependency breakage.