From cb7bf450f450d01960f5aaae9ef80a46045b019d Mon Sep 17 00:00:00 2001 From: assakali Date: Thu, 15 May 2025 13:46:49 +0200 Subject: [PATCH 01/66] =?UTF-8?q?Retire=20db.sqlite3=20du=20repo,=20d?= =?UTF-8?q?=C3=A9sormais=20ignor=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oc-lettings-site.sqlite3 | Bin 151552 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 oc-lettings-site.sqlite3 diff --git a/oc-lettings-site.sqlite3 b/oc-lettings-site.sqlite3 deleted file mode 100644 index 3d885414f9f3ed046704e8b09bdcd5c791c82d42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 151552 zcmeI5du$uYeaE?cijv5&B+InV_G$GxAFD{(Cm*^vIohTkwjQ=DTbA1cu_9O0%6!O6 zQm<=@%6DneM-nuBr7ikIi=rtOXqrEg0-c#% za+l=F(m4hiUw*{hm^=HM-+bpYGrOFb)z0l(^IBD9H_CcZsj{N$l#5|pFSD%6<(k6( zkK+I9pIQ9HTR*`6GPdtWeVuYmT==k$7^ANfn~3qxQRWa21b_e#00KY&2mk>f00e*l z5C8%|00=yN0{zd2u+!eIS6t|m=qFGP4Tk?N{KMfZq5lp2erPu&b$`D5=ezHA_jG-# z>x0+`K0p8n00AHX1b_e#00KY&2pmm7?De@Wj;1PVrJ|Kf6^`Thj8@XBnop@r5>Mad^A zn>aH*Q`^odRW-A%m-qHF+p1pF3@J|83kg}2xT^?zSg3p8GD@MU>Y2P=u5D*ZN>R-e zl|8Jil&@|&I*G+&a$+Woo!l{M#xj8BKKquX^y3A-cW?IeQu zWKxdZ=*E6tsr!kWes+|ChWV8BN=C`$GODhZ^-K}hmXcR1PNm}$g2W4{F6?Zs?ktwk z)rU1rS2Njisj8N$)%|U?lEL*QIJ$_*$ynk_Cw6h8?n1VgivlW?^I9oWsudg?3NOcE zG5O^n_EE2EP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;G4PVNF=rUA(p? ztgYTTSX#;R3p3XXiz^HK!pgF?wpGv;x3=SRh2&=L-g5b#c=zD`z3Usw>MdFb+oLbb47yrs=wy}m*1rjvYDxVwK(z(o-9Bu^e|+gsRruz!Db zZExY=%GScxm952V3%g6JX?g7+eSq~B7p|@C-`^?}7lm8g;>xYPxe|A|zU76GARF>X z{FIEhDZx7fB;sWKpF#iR!vDbs2mk>f00e*l5C8%|00;m9AOHk_01$Wv2@HD{g2&B@ w7~}uXxzOjH!2*J0AOHk_01yBIKmZ5;0U!VbfB+Bx0zkkdaM6 Date: Thu, 15 May 2025 13:52:19 +0200 Subject: [PATCH 02/66] =?UTF-8?q?Recup=C3=A8ration=20du=20projet=20et=20pr?= =?UTF-8?q?emi=C3=A8re=20restructuration=20des=20mod=C3=A8les,=20templates?= =?UTF-8?q?=20et=20views?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++ lettings/__init__.py | 0 lettings/admin.py | 3 ++ lettings/apps.py | 5 ++ lettings/migrations/0001_initial.py | 36 ++++++++++++++ lettings/migrations/0002_copy_data.py | 40 ++++++++++++++++ lettings/migrations/__init__.py | 0 lettings/models.py | 24 ++++++++++ .../templates/lettings}/letting.html | 0 .../templates/lettings}/lettings_index.html | 0 lettings/tests.py | 3 ++ lettings/views.py | 19 ++++++++ oc_lettings_site/admin.py | 6 +-- .../migrations/0002_auto_20250515_1316.py | 30 ++++++++++++ oc_lettings_site/models.py | 25 ---------- oc_lettings_site/settings.py | 2 + oc_lettings_site/urls.py | 18 ++++--- oc_lettings_site/views.py | 45 ++++-------------- profiles/__init__.py | 0 profiles/admin.py | 3 ++ profiles/apps.py | 5 ++ profiles/migrations/0001_initial.py | 25 ++++++++++ profiles/migrations/0002_copy_data.py | 26 ++++++++++ profiles/migrations/__init__.py | 0 profiles/models.py | 11 +++++ .../templates/profiles}/profile.html | 0 .../templates/profiles}/profiles_index.html | 0 profiles/tests.py | 3 ++ profiles/views.py | 17 +++++++ requirements.txt | Bin 46 -> 526 bytes setup.cfg | 6 ++- 31 files changed, 283 insertions(+), 72 deletions(-) create mode 100644 lettings/__init__.py create mode 100644 lettings/admin.py create mode 100644 lettings/apps.py create mode 100644 lettings/migrations/0001_initial.py create mode 100644 lettings/migrations/0002_copy_data.py create mode 100644 lettings/migrations/__init__.py create mode 100644 lettings/models.py rename {templates => lettings/templates/lettings}/letting.html (100%) rename {templates => lettings/templates/lettings}/lettings_index.html (100%) create mode 100644 lettings/tests.py create mode 100644 lettings/views.py create mode 100644 oc_lettings_site/migrations/0002_auto_20250515_1316.py create mode 100644 profiles/__init__.py create mode 100644 profiles/admin.py create mode 100644 profiles/apps.py create mode 100644 profiles/migrations/0001_initial.py create mode 100644 profiles/migrations/0002_copy_data.py create mode 100644 profiles/migrations/__init__.py create mode 100644 profiles/models.py rename {templates => profiles/templates/profiles}/profile.html (100%) rename {templates => profiles/templates/profiles}/profiles_index.html (100%) create mode 100644 profiles/tests.py create mode 100644 profiles/views.py diff --git a/.gitignore b/.gitignore index b4405ebab4..597a1916cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ **/__pycache__ *.pyc venv +.venv +.pytest_cache +oc-lettings-site.sqlite3 \ No newline at end of file diff --git a/lettings/__init__.py b/lettings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lettings/admin.py b/lettings/admin.py new file mode 100644 index 0000000000..8c38f3f3da --- /dev/null +++ b/lettings/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/lettings/apps.py b/lettings/apps.py new file mode 100644 index 0000000000..b6abff1791 --- /dev/null +++ b/lettings/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class LettingsConfig(AppConfig): + name = 'lettings' diff --git a/lettings/migrations/0001_initial.py b/lettings/migrations/0001_initial.py new file mode 100644 index 0000000000..8c8d3dd174 --- /dev/null +++ b/lettings/migrations/0001_initial.py @@ -0,0 +1,36 @@ +# Generated by Django 3.0 on 2025-05-15 08:29 + +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Address', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('number', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(9999)])), + ('street', models.CharField(max_length=64)), + ('city', models.CharField(max_length=64)), + ('state', models.CharField(max_length=2, validators=[django.core.validators.MinLengthValidator(2)])), + ('zip_code', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(99999)])), + ('country_iso_code', models.CharField(max_length=3, validators=[django.core.validators.MinLengthValidator(3)])), + ], + ), + migrations.CreateModel( + name='Letting', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=256)), + ('address', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='lettings.Address')), + ], + ), + ] diff --git a/lettings/migrations/0002_copy_data.py b/lettings/migrations/0002_copy_data.py new file mode 100644 index 0000000000..9a26675832 --- /dev/null +++ b/lettings/migrations/0002_copy_data.py @@ -0,0 +1,40 @@ +from django.db import migrations + + +def copy_lettings_data(apps, schema_editor): + OldAddress = apps.get_model('oc_lettings_site', 'Address') + OldLetting = apps.get_model('oc_lettings_site', 'Letting') + + NewAddress = apps.get_model('lettings', 'Address') + NewLetting = apps.get_model('lettings', 'Letting') + + + address_mapping = {} + + for old_address in OldAddress.objects.all(): + new_address=NewAddress.objects.create( + number=old_address.number, + street=old_address.street, + city=old_address.city, + state=old_address.state, + zip_code=old_address.zip_code, + country_iso_code=old_address.country_iso_code, + ) + + address_mapping[old_address.id] = new_address + + + for old_letting in OldLetting.objects.all(): + NewLetting.objects.create( + title=old_letting.title, + address=address_mapping[old_letting.address_id], + ) + +class Migration(migrations.Migration): + dependencies = [ + ('lettings', '0001_initial'), + ] + + operations = [ + migrations.RunPython(copy_lettings_data), + ] \ No newline at end of file diff --git a/lettings/migrations/__init__.py b/lettings/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lettings/models.py b/lettings/models.py new file mode 100644 index 0000000000..26547bc16b --- /dev/null +++ b/lettings/models.py @@ -0,0 +1,24 @@ +from django.db import models +from django.core.validators import MaxValueValidator, MinLengthValidator + + + +class Address(models.Model): + number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)]) + street = models.CharField(max_length=64) + city = models.CharField(max_length=64) + state = models.CharField(max_length=2, validators=[MinLengthValidator(2)]) + zip_code = models.PositiveIntegerField(validators=[MaxValueValidator(99999)]) + country_iso_code = models.CharField(max_length=3, validators=[MinLengthValidator(3)]) + + def __str__(self): + return f'{self.number} {self.street}' + + + +class Letting(models.Model): + title = models.CharField(max_length=256) + address = models.OneToOneField(Address, on_delete=models.CASCADE) + + def __str__(self): + return self.title \ No newline at end of file diff --git a/templates/letting.html b/lettings/templates/lettings/letting.html similarity index 100% rename from templates/letting.html rename to lettings/templates/lettings/letting.html diff --git a/templates/lettings_index.html b/lettings/templates/lettings/lettings_index.html similarity index 100% rename from templates/lettings_index.html rename to lettings/templates/lettings/lettings_index.html diff --git a/lettings/tests.py b/lettings/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/lettings/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/lettings/views.py b/lettings/views.py new file mode 100644 index 0000000000..a3fd8f1acf --- /dev/null +++ b/lettings/views.py @@ -0,0 +1,19 @@ +from django.shortcuts import render +from lettings.models import Letting +# Create your views here. + + +def lettings_index(request): + lettings_list = Letting.objects.all() + context = {'lettings_list': lettings_list} + return render(request, 'lettings/lettings_index.html', context) + + + +def letting(request, letting_id): + letting = Letting.objects.get(id=letting_id) + context = { + 'title': letting.title, + 'address': letting.address, + } + return render(request, 'lettings/letting.html', context) \ No newline at end of file diff --git a/oc_lettings_site/admin.py b/oc_lettings_site/admin.py index 63328c6dd3..390b8ce67e 100644 --- a/oc_lettings_site/admin.py +++ b/oc_lettings_site/admin.py @@ -1,8 +1,8 @@ from django.contrib import admin -from .models import Letting -from .models import Address -from .models import Profile +from lettings.models import Letting +from lettings.models import Address +from profiles.models import Profile admin.site.register(Letting) diff --git a/oc_lettings_site/migrations/0002_auto_20250515_1316.py b/oc_lettings_site/migrations/0002_auto_20250515_1316.py new file mode 100644 index 0000000000..d6deb9d9e2 --- /dev/null +++ b/oc_lettings_site/migrations/0002_auto_20250515_1316.py @@ -0,0 +1,30 @@ +# Generated by Django 3.0 on 2025-05-15 11:16 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('oc_lettings_site', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='letting', + name='address', + ), + migrations.RemoveField( + model_name='profile', + name='user', + ), + migrations.DeleteModel( + name='Address', + ), + migrations.DeleteModel( + name='Letting', + ), + migrations.DeleteModel( + name='Profile', + ), + ] diff --git a/oc_lettings_site/models.py b/oc_lettings_site/models.py index ed255e8c11..6fb66a5e2f 100644 --- a/oc_lettings_site/models.py +++ b/oc_lettings_site/models.py @@ -1,31 +1,6 @@ -from django.db import models -from django.core.validators import MaxValueValidator, MinLengthValidator -from django.contrib.auth.models import User -class Address(models.Model): - number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)]) - street = models.CharField(max_length=64) - city = models.CharField(max_length=64) - state = models.CharField(max_length=2, validators=[MinLengthValidator(2)]) - zip_code = models.PositiveIntegerField(validators=[MaxValueValidator(99999)]) - country_iso_code = models.CharField(max_length=3, validators=[MinLengthValidator(3)]) - def __str__(self): - return f'{self.number} {self.street}' -class Letting(models.Model): - title = models.CharField(max_length=256) - address = models.OneToOneField(Address, on_delete=models.CASCADE) - def __str__(self): - return self.title - - -class Profile(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE) - favorite_city = models.CharField(max_length=64, blank=True) - - def __str__(self): - return self.user.username diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index a18bee8106..1a625d5954 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -28,6 +28,8 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'lettings', + 'profiles' ] MIDDLEWARE = [ diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index f0ff5897ab..ee68f53a57 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -1,13 +1,19 @@ from django.contrib import admin from django.urls import path +from oc_lettings_site import views as core_view +from lettings import views as lettings_views +from profiles import views as profiles_views + + + + -from . import views urlpatterns = [ - path('', views.index, name='index'), - path('lettings/', views.lettings_index, name='lettings_index'), - path('lettings//', views.letting, name='letting'), - path('profiles/', views.profiles_index, name='profiles_index'), - path('profiles//', views.profile, name='profile'), + path('', core_view.index, name='index'), + path('lettings/', lettings_views.lettings_index, name='lettings_index'), + path('lettings//', lettings_views.letting, name='letting'), + path('profiles/', profiles_views.profiles_index, name='profiles_index'), + path('profiles//', profiles_views.profile, name='profile'), path('admin/', admin.site.urls), ] diff --git a/oc_lettings_site/views.py b/oc_lettings_site/views.py index a72db27074..c55a9a3fac 100644 --- a/oc_lettings_site/views.py +++ b/oc_lettings_site/views.py @@ -1,45 +1,16 @@ from django.shortcuts import render -from .models import Letting, Profile -# Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque molestie quam lobortis leo consectetur ullamcorper non id est. Praesent dictum, nulla eget feugiat sagittis, sem mi convallis eros, -# vitae dapibus nisi lorem dapibus sem. Maecenas pharetra purus ipsum, eget consequat ipsum lobortis quis. Phasellus eleifend ex auctor venenatis tempus. -# Aliquam vitae erat ac orci placerat luctus. Nullam elementum urna nisi, pellentesque iaculis enim cursus in. Praesent volutpat porttitor magna, non finibus neque cursus id. + + def index(request): return render(request, 'index.html') -# Aenean leo magna, vestibulum et tincidunt fermentum, consectetur quis velit. Sed non placerat massa. Integer est nunc, pulvinar a -# tempor et, bibendum id arcu. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Cras eget scelerisque -def lettings_index(request): - lettings_list = Letting.objects.all() - context = {'lettings_list': lettings_list} - return render(request, 'lettings_index.html', context) - - -#Cras ultricies dignissim purus, vitae hendrerit ex varius non. In accumsan porta nisl id eleifend. Praesent dignissim, odio eu consequat pretium, purus urna vulputate arcu, vitae efficitur -# lacus justo nec purus. Aenean finibus faucibus lectus at porta. Maecenas auctor, est ut luctus congue, dui enim mattis enim, ac condimentum velit libero in magna. Suspendisse potenti. In tempus a nisi sed laoreet. -# Suspendisse porta dui eget sem accumsan interdum. Ut quis urna pellentesque justo mattis ullamcorper ac non tellus. In tristique mauris eu velit fermentum, tempus pharetra est luctus. Vivamus consequat aliquam libero, eget bibendum lorem. Sed non dolor risus. Mauris condimentum auctor elementum. Donec quis nisi ligula. Integer vehicula tincidunt enim, ac lacinia augue pulvinar sit amet. -def letting(request, letting_id): - letting = Letting.objects.get(id=letting_id) - context = { - 'title': letting.title, - 'address': letting.address, - } - return render(request, 'letting.html', context) - -# Sed placerat quam in pulvinar commodo. Nullam laoreet consectetur ex, sed consequat libero pulvinar eget. Fusc -# faucibus, urna quis auctor pharetra, massa dolor cursus neque, quis dictum lacus d -def profiles_index(request): - profiles_list = Profile.objects.all() - context = {'profiles_list': profiles_list} - return render(request, 'profiles_index.html', context) - -# Aliquam sed metus eget nisi tincidunt ornare accumsan eget lac -# laoreet neque quis, pellentesque dui. Nullam facilisis pharetra vulputate. Sed tincidunt, dolor id facilisis fringilla, eros leo tristique lacus, -# it. Nam aliquam dignissim congue. Pellentesque habitant morbi tristique senectus et netus et males -def profile(request, username): - profile = Profile.objects.get(user__username=username) - context = {'profile': profile} - return render(request, 'profile.html', context) + + + + + + diff --git a/profiles/__init__.py b/profiles/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/profiles/admin.py b/profiles/admin.py new file mode 100644 index 0000000000..8c38f3f3da --- /dev/null +++ b/profiles/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/profiles/apps.py b/profiles/apps.py new file mode 100644 index 0000000000..5501fdad35 --- /dev/null +++ b/profiles/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ProfilesConfig(AppConfig): + name = 'profiles' diff --git a/profiles/migrations/0001_initial.py b/profiles/migrations/0001_initial.py new file mode 100644 index 0000000000..a1c7e4aa39 --- /dev/null +++ b/profiles/migrations/0001_initial.py @@ -0,0 +1,25 @@ +# Generated by Django 3.0 on 2025-05-15 08:29 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Profile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('favorite_city', models.CharField(blank=True, max_length=64)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/profiles/migrations/0002_copy_data.py b/profiles/migrations/0002_copy_data.py new file mode 100644 index 0000000000..d4fbc3b698 --- /dev/null +++ b/profiles/migrations/0002_copy_data.py @@ -0,0 +1,26 @@ +from django.db import migrations + + + + +def copy_profiles_data(apps, schema_editor): + OldProfile = apps.get_model('oc_lettings_site', 'Profile') + NewProfile = apps.get_model('profiles', 'Profile') + + + + for old_profile in OldProfile.objects.all(): + NewProfile.objects.create( + user=old_profile.user, + favorite_city=old_profile.favorite_city, + ) + +class Migration(migrations.Migration): + + dependencies = [ + ('profiles', '0001_initial'), + ] + + operations = [ + migrations.RunPython(copy_profiles_data), + ] diff --git a/profiles/migrations/__init__.py b/profiles/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/profiles/models.py b/profiles/models.py new file mode 100644 index 0000000000..fcd8e9d025 --- /dev/null +++ b/profiles/models.py @@ -0,0 +1,11 @@ +from django.db import models +from django.contrib.auth.models import User + + + +class Profile(models.Model): + user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile') + favorite_city = models.CharField(max_length=64, blank=True) + + def __str__(self): + return self.user.username diff --git a/templates/profile.html b/profiles/templates/profiles/profile.html similarity index 100% rename from templates/profile.html rename to profiles/templates/profiles/profile.html diff --git a/templates/profiles_index.html b/profiles/templates/profiles/profiles_index.html similarity index 100% rename from templates/profiles_index.html rename to profiles/templates/profiles/profiles_index.html diff --git a/profiles/tests.py b/profiles/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/profiles/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/profiles/views.py b/profiles/views.py new file mode 100644 index 0000000000..85bd7f6b24 --- /dev/null +++ b/profiles/views.py @@ -0,0 +1,17 @@ +from django.shortcuts import render +from profiles.models import Profile +# Create your views here. + + + +def profiles_index(request): + profiles_list = Profile.objects.all() + context = {'profiles_list': profiles_list} + return render(request, 'profiles/profiles_index.html', context) + + + +def profile(request, username): + profile = Profile.objects.get(user__username=username) + context = {'profile': profile} + return render(request, 'profiles/profile.html', context) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c48c84ea409eb5d30f815c308247cfdcb2b44b99..f7a9c27fc5e6c590e97bd1dbec04b6622b0a36b3 100644 GIT binary patch literal 526 zcmZvZ$!@|x5Jc;YlurTKY$1o-@*|E}WWwTjh!pej!0R471__})FjZYuUA|rl1#MKR z(MoH5@|$R+1(WMd1C=^z$22OmXN-}7PMNtgzO?22fXXrLXO66RJ+axU2CMvEND33@ ztWhuYgZmsL|gY?q8_-Wg&ln?#WSzJC0^O(j7`?;p6)8BcFUjb`a*SOk(9(apBUj&L&@b7okA_S7u534ciyPH%OgsPp literal 46 qcmYevO3X{ox3x9aGvG?gNz6{Q0I|)1yn@P-)Z!A|6u1IQJp%wxJPr8( diff --git a/setup.cfg b/setup.cfg index 9346841bbc..d3ff3827ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,10 @@ [flake8] max-line-length = 99 -exclude = **/migrations/*,venv +exclude = + **/migrations/*, + .venv, + venv, + __pycache__ [tool:pytest] DJANGO_SETTINGS_MODULE = oc_lettings_site.settings From d2ac29fc647c9ff433460fa2309daf25f8e8891b Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 19 May 2025 14:42:53 +0200 Subject: [PATCH 03/66] =?UTF-8?q?Ajout=20de=20test=20unitaire,=20de=20page?= =?UTF-8?q?=20personnalis=C3=A9=20des=20erreurs=20404=20ou=20500,=20correc?= =?UTF-8?q?tion=20des=20erreurs=20flake8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .coverage | Bin 0 -> 53248 bytes lettings/admin.py | 3 - lettings/apps.py | 2 +- lettings/migrations/0001_initial.py | 73 +++++++++++--- lettings/migrations/0002_copy_data.py | 40 -------- lettings/models.py | 19 ++-- .../{lettings_index.html => index.html} | 4 +- lettings/templates/lettings/letting.html | 4 +- lettings/tests.py | 31 +++++- lettings/urls.py | 10 ++ lettings/views.py | 15 +-- manage.py | 4 +- oc_lettings_site/admin.py | 4 +- oc_lettings_site/apps.py | 2 +- oc_lettings_site/asgi.py | 2 +- oc_lettings_site/migrations/0001_initial.py | 94 ++++++++++++++---- .../migrations/0002_auto_20250515_1316.py | 30 ------ oc_lettings_site/models.py | 6 -- oc_lettings_site/settings.py | 88 ++++++++-------- oc_lettings_site/urls.py | 21 ++-- oc_lettings_site/views.py | 14 +-- oc_lettings_site/wsgi.py | 2 +- profiles/admin.py | 3 - profiles/apps.py | 2 +- profiles/migrations/0001_initial.py | 25 ++++- profiles/migrations/0002_copy_data.py | 26 ----- profiles/models.py | 8 +- .../{profiles_index.html => index.html} | 4 +- profiles/templates/profiles/profile.html | 4 +- profiles/tests.py | 19 +++- profiles/urls.py | 10 ++ profiles/views.py | 14 +-- requirements.txt | Bin 526 -> 774 bytes templates/404.html | 6 ++ templates/500.html | 6 ++ templates/base.html | 4 +- templates/index.html | 4 +- 37 files changed, 341 insertions(+), 262 deletions(-) create mode 100644 .coverage delete mode 100644 lettings/migrations/0002_copy_data.py rename lettings/templates/lettings/{lettings_index.html => index.html} (89%) create mode 100644 lettings/urls.py delete mode 100644 oc_lettings_site/migrations/0002_auto_20250515_1316.py delete mode 100644 profiles/migrations/0002_copy_data.py rename profiles/templates/profiles/{profiles_index.html => index.html} (88%) create mode 100644 profiles/urls.py create mode 100644 templates/404.html create mode 100644 templates/500.html diff --git a/.coverage b/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..dba64cdfdb538ac83980b002d0fc078911f89019 GIT binary patch literal 53248 zcmeI5Ta4UR8OO&nUVH4hoV|~hRar}vY?khBvZ_KtX=sylk#ZxKCRGtbC*B$FuG^XM z#P%fFhYBXG6xxbXc%l+iydb1-dFvaON<6_!)dvbih=>AdUJx&!AQd%y=Zx*~W;0dg zT_x)Bw`S%$w$J(eKfm*xW1pF|_wiH5Y~M1L9k*fn#)GNBlq97dHH=g$rPI4W?{HBm zA%`nurC7ROQculSr2=~*l~=x*Vow!Lu(|yA3OjOdUa zHY+j&NAs;qes=>ovFw#5&tdEgiq9CXwQRXovub%=6+7+Pj6U<+*L1ZsG9q2EM4e2x zO0V3y+R%nxRSqwcqpIW9xcVj6Y*tq-Z`LrQ8de?BdCBkA)^!@Ye8;HUO;OFJXZyC( zG^|Tjwe4HAJ63R(Lkkyz7q1QZI>#$?u3IuVR*X)s@EuA9*@ME%B(CX%SbGKep{cOY z+-x_N2>H|PMvFHNmFOPWclwp=SJroe%6{awxkFp_>btHvL*%?gyQSJq`+VDq8h_U4 zm7EpTXgae7uLMQFr*lf_b0boUqSCtLov+jNR>f@lj##fy<5w2wBmewRRxM3UNmtH` zK;d{QOSbPt32j}_M4S7B4&UEDZg?+QA0)gN)$4|{EV>LYZFC!lqB-7Yc7-rZmv=P7 z2{Mw>dm3$AENL*7>dw;oSQ8QBS=2#jEC{nLx0_YoRXkpYs&m0|%@u1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DxAMiCIs*|p@pB9)=9>@m4BnXG*xUD1?X zP3|lb7CBSCB-2CjHaCdJ!ek)1yGUEio&1E{*_BM)hPaN+|1(?YHl{XxQ0{1(od4tb ze|P251qT5E5C8!X009sH0T2KI5C8!X0D*f&AR}c`1^)ZL#QvM27Zwlz0T2KI5C8!X z009sH0T2KI5CDN~NFb9bXyX2V_K6g`N&f-h9rhOc4f`c~o&A*kkbR$ho4vp~Y>heW zDR!D2W{wSe*|C5C2!H?xfB*=900@8p2!H?xfWS5(kS)oQHeAx*%&6m(8XUix z$&T?&WBQvVb(C)!y_!)+cw%HnS{>$z;kTJSM2YdCeS2=b$JijHjlq4tyS4Vg!&4u; zr)C*#7-p~C{G?K(RIw;21#SyzCC_bM(sN|Tb1&ce(@jay`8HirG;TFX$#R>ORF&+Y zdVO3|C^4#BzxM99GQjr@NQ%s@ERAN!ekQZym4m7D4Q5<=qmj9Kxu~T1Ui!a(lB{XN z*E@M}|35QR?0xnx_78TQU1NWsZvlSGeoapVe4YJ_{fPa5y~@7BUSiL)XW0e%E?||i zV*vpW009sH0T2KI5C8!X009sH0T752;4^foR1#)lm~>jEuK>jF|Ea;a zV5C6+1V8`;KmY_l00ck)1V8`;KmY``8v*|NKj#12tyNJU5C8!X009sH0T2KI5C8!X p009tKPk`V5kNN+4CRhUj5C8!X009sH0T2KI5C8!X0DLettings @@ -36,7 +36,7 @@

Lettings

Home - + Profiles diff --git a/lettings/templates/lettings/letting.html b/lettings/templates/lettings/letting.html index 7e5f3a73fd..252d68035e 100644 --- a/lettings/templates/lettings/letting.html +++ b/lettings/templates/lettings/letting.html @@ -25,14 +25,14 @@

{{ title }}

diff --git a/lettings/tests.py b/lettings/tests.py index 7ce503c2dd..7bd469ca82 100644 --- a/lettings/tests.py +++ b/lettings/tests.py @@ -1,3 +1,32 @@ from django.test import TestCase +from django.urls import reverse +from .models import Address, Letting -# Create your tests here. + + +class LettingsViewsTests(TestCase): + def setUp(self): + self.address = Address.objects.create( + number=123, + street='Main street', + city='Miami', + state='Florida', + zip_code=98210, + country_iso_code='USA', + ) + + self.letting = Letting.objects.create( + title='House', + address=self.address + ) + def test_lettings_index_view(self): + url = reverse('lettings:index') + response = self.client.get(url) + self.assertEqual(response.status_code, 200) + self.assertContains(response, 'House') + + def test_lettings_detail_view(self): + url = reverse('lettings:letting', args=[self.letting.id]) + response = self.client.get(url) + self.assertEqual(response.status_code, 200) + self.assertContains(response, 'Main street') diff --git a/lettings/urls.py b/lettings/urls.py new file mode 100644 index 0000000000..bb049b05c4 --- /dev/null +++ b/lettings/urls.py @@ -0,0 +1,10 @@ +from django.urls import path + +from . import views + +app_name = "lettings" + +urlpatterns = [ + path("", views.index, name="index"), + path("/", views.letting, name="letting"), +] diff --git a/lettings/views.py b/lettings/views.py index a3fd8f1acf..d05768cf11 100644 --- a/lettings/views.py +++ b/lettings/views.py @@ -1,19 +1,20 @@ from django.shortcuts import render + from lettings.models import Letting + # Create your views here. -def lettings_index(request): +def index(request): lettings_list = Letting.objects.all() - context = {'lettings_list': lettings_list} - return render(request, 'lettings/lettings_index.html', context) - + context = {"lettings_list": lettings_list} + return render(request, "lettings/index.html", context) def letting(request, letting_id): letting = Letting.objects.get(id=letting_id) context = { - 'title': letting.title, - 'address': letting.address, + "title": letting.title, + "address": letting.address, } - return render(request, 'lettings/letting.html', context) \ No newline at end of file + return render(request, "lettings/letting.html", context) diff --git a/manage.py b/manage.py index c0e27e034a..9ee5ca3e04 100755 --- a/manage.py +++ b/manage.py @@ -3,7 +3,7 @@ def main(): - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oc_lettings_site.settings') + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oc_lettings_site.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: @@ -15,5 +15,5 @@ def main(): execute_from_command_line(sys.argv) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/oc_lettings_site/admin.py b/oc_lettings_site/admin.py index 390b8ce67e..574d0e56e1 100644 --- a/oc_lettings_site/admin.py +++ b/oc_lettings_site/admin.py @@ -1,10 +1,8 @@ from django.contrib import admin -from lettings.models import Letting -from lettings.models import Address +from lettings.models import Address, Letting from profiles.models import Profile - admin.site.register(Letting) admin.site.register(Address) admin.site.register(Profile) diff --git a/oc_lettings_site/apps.py b/oc_lettings_site/apps.py index 6489692f04..df4f565ffc 100644 --- a/oc_lettings_site/apps.py +++ b/oc_lettings_site/apps.py @@ -2,4 +2,4 @@ class OCLettingsSiteConfig(AppConfig): - name = 'oc_lettings_site' + name = "oc_lettings_site" diff --git a/oc_lettings_site/asgi.py b/oc_lettings_site/asgi.py index 61f2d23ba3..318cce1ff9 100644 --- a/oc_lettings_site/asgi.py +++ b/oc_lettings_site/asgi.py @@ -2,6 +2,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oc_lettings_site.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oc_lettings_site.settings") application = get_asgi_application() diff --git a/oc_lettings_site/migrations/0001_initial.py b/oc_lettings_site/migrations/0001_initial.py index 774cf23f58..8655dcc13d 100644 --- a/oc_lettings_site/migrations/0001_initial.py +++ b/oc_lettings_site/migrations/0001_initial.py @@ -1,9 +1,9 @@ # Generated by Django 3.0 on 2020-06-14 09:35 -from django.conf import settings import django.core.validators -from django.db import migrations, models import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,31 +16,89 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='Address', + name="Address", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('number', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(9999)])), - ('street', models.CharField(max_length=64)), - ('city', models.CharField(max_length=64)), - ('state', models.CharField(max_length=2, validators=[django.core.validators.MinLengthValidator(2)])), - ('zip_code', models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(99999)])), - ('country_iso_code', models.CharField(max_length=3, validators=[django.core.validators.MinLengthValidator(3)])), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "number", + models.PositiveIntegerField( + validators=[django.core.validators.MaxValueValidator(9999)] + ), + ), + ("street", models.CharField(max_length=64)), + ("city", models.CharField(max_length=64)), + ( + "state", + models.CharField( + max_length=2, + validators=[django.core.validators.MinLengthValidator(2)], + ), + ), + ( + "zip_code", + models.PositiveIntegerField( + validators=[django.core.validators.MaxValueValidator(99999)] + ), + ), + ( + "country_iso_code", + models.CharField( + max_length=3, + validators=[django.core.validators.MinLengthValidator(3)], + ), + ), ], ), migrations.CreateModel( - name='Profile', + name="Profile", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('favorite_city', models.CharField(blank=True, max_length=64)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("favorite_city", models.CharField(blank=True, max_length=64)), + ( + "user", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.CreateModel( - name='Letting', + name="Letting", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=256)), - ('address', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='oc_lettings_site.Address')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=256)), + ( + "address", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="oc_lettings_site.Address", + ), + ), ], ), ] diff --git a/oc_lettings_site/migrations/0002_auto_20250515_1316.py b/oc_lettings_site/migrations/0002_auto_20250515_1316.py deleted file mode 100644 index d6deb9d9e2..0000000000 --- a/oc_lettings_site/migrations/0002_auto_20250515_1316.py +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Django 3.0 on 2025-05-15 11:16 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('oc_lettings_site', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='letting', - name='address', - ), - migrations.RemoveField( - model_name='profile', - name='user', - ), - migrations.DeleteModel( - name='Address', - ), - migrations.DeleteModel( - name='Letting', - ), - migrations.DeleteModel( - name='Profile', - ), - ] diff --git a/oc_lettings_site/models.py b/oc_lettings_site/models.py index 6fb66a5e2f..e69de29bb2 100644 --- a/oc_lettings_site/models.py +++ b/oc_lettings_site/models.py @@ -1,6 +0,0 @@ - - - - - - diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 1a625d5954..49aeafc44c 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -1,5 +1,4 @@ import os - from pathlib import Path # Build paths inside the project like this: os.path.join(BASE_DIR, ...) @@ -10,66 +9,65 @@ # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'fp$9^593hsriajg$_%=5trot9g!1qa@ew(o-1#@=&4%=hp46(s' +SECRET_KEY = "fp$9^593hsriajg$_%=5trot9g!1qa@ew(o-1#@=&4%=hp46(s" # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] # Application definition -INSTALLED_APPS = [ - 'oc_lettings_site.apps.OCLettingsSiteConfig', - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'lettings', - 'profiles' +INSTALLED_APPS = [ + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "lettings", + "profiles", ] MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', + "django.middleware.security.SecurityMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -ROOT_URLCONF = 'oc_lettings_site.urls' +ROOT_URLCONF = "oc_lettings_site.urls" TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [os.path.join(BASE_DIR, "templates")], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ], }, }, ] -WSGI_APPLICATION = 'oc_lettings_site.wsgi.application' +WSGI_APPLICATION = "oc_lettings_site.wsgi.application" # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'oc-lettings-site.sqlite3'), + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": os.path.join(BASE_DIR, "oc-lettings-site.sqlite3"), } } @@ -79,16 +77,16 @@ AUTH_PASSWORD_VALIDATORS = [ { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", }, ] @@ -96,9 +94,9 @@ # Internationalization # https://docs.djangoproject.com/en/3.0/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = "en-us" -TIME_ZONE = 'UTC' +TIME_ZONE = "UTC" USE_I18N = True @@ -110,7 +108,9 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') +STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") -STATIC_URL = '/static/' -STATICFILES_DIRS = [BASE_DIR / "static",] +STATIC_URL = "/static/" +STATICFILES_DIRS = [ + BASE_DIR / "static", +] diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index ee68f53a57..dfe976302a 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -1,19 +1,12 @@ from django.contrib import admin -from django.urls import path -from oc_lettings_site import views as core_view -from lettings import views as lettings_views -from profiles import views as profiles_views - - - - +from django.urls import include, path +from oc_lettings_site import views as core_view urlpatterns = [ - path('', core_view.index, name='index'), - path('lettings/', lettings_views.lettings_index, name='lettings_index'), - path('lettings//', lettings_views.letting, name='letting'), - path('profiles/', profiles_views.profiles_index, name='profiles_index'), - path('profiles//', profiles_views.profile, name='profile'), - path('admin/', admin.site.urls), + path("", core_view.index, name="index"), + path("lettings/", include("lettings.urls", namespace="lettings")), + path("profiles/", include("profiles.urls", namespace="profiles")), + path("admin/", admin.site.urls), + path('test500', core_view.test_500), ] diff --git a/oc_lettings_site/views.py b/oc_lettings_site/views.py index c55a9a3fac..95ad924db2 100644 --- a/oc_lettings_site/views.py +++ b/oc_lettings_site/views.py @@ -1,16 +1,10 @@ from django.shortcuts import render - - - - +from django.http import HttpResponse def index(request): - return render(request, 'index.html') - - - - - + return render(request, "index.html") +def test_500(request): + raise Exception('Erreur de pour le 500') \ No newline at end of file diff --git a/oc_lettings_site/wsgi.py b/oc_lettings_site/wsgi.py index d78ca6d669..7b4afb7e59 100644 --- a/oc_lettings_site/wsgi.py +++ b/oc_lettings_site/wsgi.py @@ -2,6 +2,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oc_lettings_site.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oc_lettings_site.settings") application = get_wsgi_application() diff --git a/profiles/admin.py b/profiles/admin.py index 8c38f3f3da..e69de29bb2 100644 --- a/profiles/admin.py +++ b/profiles/admin.py @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/profiles/apps.py b/profiles/apps.py index 5501fdad35..61722aa9a9 100644 --- a/profiles/apps.py +++ b/profiles/apps.py @@ -2,4 +2,4 @@ class ProfilesConfig(AppConfig): - name = 'profiles' + name = "profiles" diff --git a/profiles/migrations/0001_initial.py b/profiles/migrations/0001_initial.py index a1c7e4aa39..414b23fe67 100644 --- a/profiles/migrations/0001_initial.py +++ b/profiles/migrations/0001_initial.py @@ -1,8 +1,8 @@ # Generated by Django 3.0 on 2025-05-15 08:29 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): @@ -15,11 +15,26 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='Profile', + name="Profile", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('favorite_city', models.CharField(blank=True, max_length=64)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("favorite_city", models.CharField(blank=True, max_length=64)), + ( + "user", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name="profile", + to=settings.AUTH_USER_MODEL, + ), + ), ], ), ] diff --git a/profiles/migrations/0002_copy_data.py b/profiles/migrations/0002_copy_data.py deleted file mode 100644 index d4fbc3b698..0000000000 --- a/profiles/migrations/0002_copy_data.py +++ /dev/null @@ -1,26 +0,0 @@ -from django.db import migrations - - - - -def copy_profiles_data(apps, schema_editor): - OldProfile = apps.get_model('oc_lettings_site', 'Profile') - NewProfile = apps.get_model('profiles', 'Profile') - - - - for old_profile in OldProfile.objects.all(): - NewProfile.objects.create( - user=old_profile.user, - favorite_city=old_profile.favorite_city, - ) - -class Migration(migrations.Migration): - - dependencies = [ - ('profiles', '0001_initial'), - ] - - operations = [ - migrations.RunPython(copy_profiles_data), - ] diff --git a/profiles/models.py b/profiles/models.py index fcd8e9d025..abd1a89a5f 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -1,11 +1,13 @@ -from django.db import models from django.contrib.auth.models import User - +from django.db import models class Profile(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile') + user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile") favorite_city = models.CharField(max_length=64, blank=True) + class Meta: + verbose_name_plural = "Profiles" + def __str__(self): return self.user.username diff --git a/profiles/templates/profiles/profiles_index.html b/profiles/templates/profiles/index.html similarity index 88% rename from profiles/templates/profiles/profiles_index.html rename to profiles/templates/profiles/index.html index 4ad1daf92f..563b7a0166 100644 --- a/profiles/templates/profiles/profiles_index.html +++ b/profiles/templates/profiles/index.html @@ -18,7 +18,7 @@

Profiles

@@ -34,7 +34,7 @@

Profiles

Home - + Lettings
diff --git a/profiles/templates/profiles/profile.html b/profiles/templates/profiles/profile.html index d150d30e63..4b1af37496 100644 --- a/profiles/templates/profiles/profile.html +++ b/profiles/templates/profiles/profile.html @@ -24,14 +24,14 @@

{{ profile.user.username }}

diff --git a/profiles/tests.py b/profiles/tests.py index 7ce503c2dd..e1f2296407 100644 --- a/profiles/tests.py +++ b/profiles/tests.py @@ -1,3 +1,20 @@ from django.test import TestCase +from django.urls import reverse +from .models import Profile +from django.contrib.auth.models import User -# Create your tests here. + +class ProfilesTests(TestCase): + def setUp(self): + self.user = User.objects.create_user(username="dan", password='1234') + self.profile = Profile.objects.create(user=self.user, favorite_city='Paris') + + def test_profile_index_view(self): + response = self.client.get(reverse('profiles:index')) + self.assertEqual(response.status_code, 200) + self.assertContains(response, 'Profiles') + + def test_profile_detail_view(self): + response = self.client.get(reverse('profiles:profile', args=[self.user.username])) + self.assertEqual(response.status_code, 200) + self.assertContains(response, 'Paris') \ No newline at end of file diff --git a/profiles/urls.py b/profiles/urls.py new file mode 100644 index 0000000000..beef005637 --- /dev/null +++ b/profiles/urls.py @@ -0,0 +1,10 @@ +from django.urls import path + +from . import views + +app_name = "profiles" + +urlpatterns = [ + path("", views.index, name="index"), + path("/", views.profile, name="profile"), +] diff --git a/profiles/views.py b/profiles/views.py index 85bd7f6b24..2d27b0beda 100644 --- a/profiles/views.py +++ b/profiles/views.py @@ -1,17 +1,17 @@ from django.shortcuts import render + from profiles.models import Profile -# Create your views here. +# Create your views here. -def profiles_index(request): +def index(request): profiles_list = Profile.objects.all() - context = {'profiles_list': profiles_list} - return render(request, 'profiles/profiles_index.html', context) - + context = {"profiles_list": profiles_list} + return render(request, "profiles/index.html", context) def profile(request, username): profile = Profile.objects.get(user__username=username) - context = {'profile': profile} - return render(request, 'profiles/profile.html', context) \ No newline at end of file + context = {"profile": profile} + return render(request, "profiles/profile.html", context) diff --git a/requirements.txt b/requirements.txt index f7a9c27fc5e6c590e97bd1dbec04b6622b0a36b3..95f6816f9b80a6baf6022d4bb6d6e2f2fa0c80de 100644 GIT binary patch delta 286 zcmX|6OAf(M6g`bkLSifiotTIL(N^h1#K;0HK&q(5uc=1ZfT4Klz!EIOO00!*ACZ@n zmv_(So_Eb(inqEu!v;PAtTEuR;i3(T=%9i!=Nm+S*5lk3PMHlez#c~|kkB6T7JHwh zh&pOGDagZC_f|E+f!YMA*7SrYEcL9pqWNyx;*6M>GU`O>0z29w8s(O7X{DQ~S99!B xvLX>v7-(8&>Ux&09_x>#SnAzd%o&#aqPmQ72v5C7ISWoUGR%?;1a=l0j}O_vGNu3k delta 75 zcmZo;>tmUqG%-eL;sQTbV+K72^NF8zC36{)fiRIFi6NE276=W15@tYbIJuQkbMhZX UD@N1FmQ1poMj$b;cs$c`0LOF@PXGV_ diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000000..ac4989df06 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% block content %} +

404 - Page non trouvée

+

La page que vous recherchez n'existe pas.

+Retour à l'acceuil +{% endblock %} \ No newline at end of file diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 0000000000..ac12f8212b --- /dev/null +++ b/templates/500.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% block content %} +

500 - Erreur interne du service

+

Une erreur s'est produite. Veuillez réessayer ultérieurement

+Retour à l'acceuil +{% endblock %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index ab7addba01..403b342755 100644 --- a/templates/base.html +++ b/templates/base.html @@ -24,10 +24,10 @@
Logo Orange County Lettings diff --git a/templates/index.html b/templates/index.html index 71a8e61a46..fc9a76c7ab 100644 --- a/templates/index.html +++ b/templates/index.html @@ -14,10 +14,10 @@

Welcome to Holiday Homes

From 66b6f6dc82851703f92e09bcf1aab8b268e9364c Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 20 May 2025 12:04:36 +0200 Subject: [PATCH 04/66] =?UTF-8?q?Ajout=20des=20docstrings=20et=20inialisat?= =?UTF-8?q?ion=20de=20sentry=20ainsi=20qu'int=C3=A9gration=20des=20logs=20?= =?UTF-8?q?dans=20les=20parties=20critiques=20de=20l'application?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- lettings/models.py | 18 ++++++++++++++++++ lettings/tests.py | 20 ++++++++++++++++++++ lettings/views.py | 24 ++++++++++++++++++++++-- oc_lettings_site/settings.py | 20 +++++++++++++++++++- oc_lettings_site/urls.py | 1 + oc_lettings_site/views.py | 11 ++++++++++- profiles/apps.py | 6 ++++++ profiles/models.py | 6 ++++++ profiles/tests.py | 19 +++++++++++++++++++ profiles/views.py | 26 ++++++++++++++++++++++++-- requirements.txt | Bin 774 -> 930 bytes 12 files changed, 147 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 597a1916cd..0b3e2d5d07 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ venv .venv .pytest_cache -oc-lettings-site.sqlite3 \ No newline at end of file +oc-lettings-site.sqlite3 +.env \ No newline at end of file diff --git a/lettings/models.py b/lettings/models.py index 164733f723..b35c00e0e0 100644 --- a/lettings/models.py +++ b/lettings/models.py @@ -3,6 +3,12 @@ class Address(models.Model): + """ + Représente une adresse postale complète. + + Contient les informations nécessaires pour identifier un lieu : + numéro, rue, ville, état, code postal du pays. + """ number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)]) street = models.CharField(max_length=64) city = models.CharField(max_length=64) @@ -15,10 +21,19 @@ class Meta: verbose_name_plural = "Addresses" def __str__(self): + """ + Retourne une version lisible de l’adresse (numéro et rue). + """ return f"{self.number} {self.street}" class Letting(models.Model): + """ + Représente une location disponible. + + Contient un titre descriptif et une relation + vers une adresse unique associée à cette location. + """ title = models.CharField(max_length=256) address = models.OneToOneField(Address, on_delete=models.CASCADE) @@ -26,4 +41,7 @@ class Meta: verbose_name_plural = "Lettings" def __str__(self): + """ + Retourne le titre de la location. + """ return self.title diff --git a/lettings/tests.py b/lettings/tests.py index 7bd469ca82..639cf3138d 100644 --- a/lettings/tests.py +++ b/lettings/tests.py @@ -5,7 +5,19 @@ class LettingsViewsTests(TestCase): + """ + Tests unitaires des vues de l'application Lettings. + + Vérifie que les pages de liste et de détail des locations + répondent correctement et affichent les bonnes informations. + """ def setUp(self): + """ + Initialise les données de test : une adresse et une location. + + Cette méthode est exécutée avant chaque test pour garantir + un environnement de test cohérent. + """ self.address = Address.objects.create( number=123, street='Main street', @@ -20,12 +32,20 @@ def setUp(self): address=self.address ) def test_lettings_index_view(self): + """ + Vérifie que la page d’index des locations retourne un code 200 + et contient le titre de la location. + """ url = reverse('lettings:index') response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertContains(response, 'House') def test_lettings_detail_view(self): + """ + Vérifie que la page de détail d’une location retourne un code 200 + et contient l’adresse de la location. + """ url = reverse('lettings:letting', args=[self.letting.id]) response = self.client.get(url) self.assertEqual(response.status_code, 200) diff --git a/lettings/views.py b/lettings/views.py index d05768cf11..e2de233775 100644 --- a/lettings/views.py +++ b/lettings/views.py @@ -1,18 +1,38 @@ from django.shortcuts import render - +import logging from lettings.models import Letting +from django.http import Http404 # Create your views here. +logger = logging.getLogger(__name__) def index(request): + """ + Affiche la liste de toutes les locations. + + Récupère tous les objets Letting depuis la base de données + et les passe au template 'lettings/index.html' via le contexte. + """ lettings_list = Letting.objects.all() context = {"lettings_list": lettings_list} return render(request, "lettings/index.html", context) def letting(request, letting_id): - letting = Letting.objects.get(id=letting_id) + """ + Affiche le détail d'une location spécifique. + + Utilise l'ID fourni dans l'URL pour récupérer un objet Letting, + puis transmet son titre et son adresse au template 'lettings/letting.html'. + """ + try: + letting = Letting.objects.get(id=letting_id) + logger.info(f"Letting accédé : {letting.title}, ID: {letting_id}") + except Letting.DoesNotExist: + logger.error(f"Letting non trouvé pout l'ID : {letting_id}") + raise Http404("Letting non trouvé") + context = { "title": letting.title, "address": letting.address, diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 49aeafc44c..671bfe6d10 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -1,5 +1,22 @@ import os +import sentry_sdk +from sentry_sdk.integrations.django import DjangoIntegration from pathlib import Path +from dotenv import load_dotenv + + +load_dotenv() + + + + +sentry_sdk.init( + dsn=os.getenv("SENTRY_DSN"), + # Add data like request headers and IP for users, + # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info + send_default_pii=True, +) + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = Path(__file__).resolve().parent.parent @@ -112,5 +129,6 @@ STATIC_URL = "/static/" STATICFILES_DIRS = [ - BASE_DIR / "static", + os.path.join(BASE_DIR, "static"), ] + diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index dfe976302a..777a6e178a 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -9,4 +9,5 @@ path("profiles/", include("profiles.urls", namespace="profiles")), path("admin/", admin.site.urls), path('test500', core_view.test_500), + path("sentry-error/", core_view.test_error), ] diff --git a/oc_lettings_site/views.py b/oc_lettings_site/views.py index 95ad924db2..41d1a2fe4d 100644 --- a/oc_lettings_site/views.py +++ b/oc_lettings_site/views.py @@ -3,8 +3,17 @@ def index(request): + """ + Affiche la page d'accueil du site. + + Rend le template 'index.html' sans contexte particulier. + """ return render(request, "index.html") def test_500(request): - raise Exception('Erreur de pour le 500') \ No newline at end of file + raise Exception('Erreur de pour le 500') + + +def test_error(request): + division_by_zero = 1 / 0 \ No newline at end of file diff --git a/profiles/apps.py b/profiles/apps.py index 61722aa9a9..5be32ceb5f 100644 --- a/profiles/apps.py +++ b/profiles/apps.py @@ -2,4 +2,10 @@ class ProfilesConfig(AppConfig): + """ + Configuration de l'application Django 'profiles'. + + Cette configuration permet à Django de reconnaître et initialiser + l'application lors du démarrage du projet. + """ name = "profiles" diff --git a/profiles/models.py b/profiles/models.py index abd1a89a5f..b05f3e07e4 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -3,6 +3,12 @@ class Profile(models.Model): + """ + Représente un profil client indépendant dans l'application. + + Ce modèle permet de stocker des informations client telles que + le nom d'utilisateur et la ville favorite. + """ user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile") favorite_city = models.CharField(max_length=64, blank=True) diff --git a/profiles/tests.py b/profiles/tests.py index e1f2296407..0edf2b0571 100644 --- a/profiles/tests.py +++ b/profiles/tests.py @@ -5,16 +5,35 @@ class ProfilesTests(TestCase): + """ + Tests unitaires des vues de l'application Profiles. + + Vérifie que les pages de liste et de détail des profils + répondent correctement et affichent les bonnes informations. + """ def setUp(self): + """ + Initialise un utilisateur et son profil associé pour les tests. + + Crée un utilisateur nommé 'dan' et un profil avec Paris comme ville favorite. + """ self.user = User.objects.create_user(username="dan", password='1234') self.profile = Profile.objects.create(user=self.user, favorite_city='Paris') def test_profile_index_view(self): + """ + Vérifie que la page d’index des profils retourne un code 200 + et contient le mot 'Profiles'. + """ response = self.client.get(reverse('profiles:index')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'Profiles') def test_profile_detail_view(self): + """ + Vérifie que la page de détail d’un profil retourne un code 200 + et contient la ville favorite du profil. + """ response = self.client.get(reverse('profiles:profile', args=[self.user.username])) self.assertEqual(response.status_code, 200) self.assertContains(response, 'Paris') \ No newline at end of file diff --git a/profiles/views.py b/profiles/views.py index 2d27b0beda..8b714dd1d1 100644 --- a/profiles/views.py +++ b/profiles/views.py @@ -1,17 +1,39 @@ from django.shortcuts import render - +import logging from profiles.models import Profile +from django.http import Http404 # Create your views here. +logger = logging.getLogger(__name__) + def index(request): + """ + Affiche la liste de tous les profils clients. + + Récupère tous les objets Profile de la base de données et les transmet + au template 'profiles/index.html' via le contexte. + """ profiles_list = Profile.objects.all() context = {"profiles_list": profiles_list} return render(request, "profiles/index.html", context) def profile(request, username): - profile = Profile.objects.get(user__username=username) + """ + Affiche le détail d’un profil client à partir du nom d’utilisateur. + + Utilise le nom d'utilisateur fourni dans l'URL pour retrouver + le profil associé via la relation au modèle User, et transmet + cet objet au template 'profiles/profile.html'. + """ + try: + profile = Profile.objects.get(user__username=username) + logger.info(f"Profile consulté : {username}") + except Profile.DoesNotExist: + logger.error(f"Profile introuvable pour l'utilisateur: {username}") + raise Http404("profile non trouvé") + context = {"profile": profile} return render(request, "profiles/profile.html", context) diff --git a/requirements.txt b/requirements.txt index 95f6816f9b80a6baf6022d4bb6d6e2f2fa0c80de..9de4482c3c0a12f4275fda62f2272310c48ac244 100644 GIT binary patch delta 149 zcmZo;Tf{!WNimh7h@pfblOYX=ZGq5;!2pO&8T1%TfY^w^Y@>B0lWYb_C&1~S7Etm-I}qe3ZAMGg>VG9)n= P!&QK6GGO3k;9>v(NCX-= delta 18 ZcmZ3)-o`e;X=7Fq(_{{2iOC+!RscEw1!VvL From 08fa178be08edc2071c37f75f2d0d79c130e3d7e Mon Sep 17 00:00:00 2001 From: assakali Date: Fri, 23 May 2025 10:13:44 +0200 Subject: [PATCH 05/66] =?UTF-8?q?Retrait=20du=20fichier=20.coverage=20du?= =?UTF-8?q?=20d=C3=A9p=C3=B4t=20et=20ajout=20au=20.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .coverage | Bin 53248 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .coverage diff --git a/.coverage b/.coverage deleted file mode 100644 index dba64cdfdb538ac83980b002d0fc078911f89019..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 53248 zcmeI5Ta4UR8OO&nUVH4hoV|~hRar}vY?khBvZ_KtX=sylk#ZxKCRGtbC*B$FuG^XM z#P%fFhYBXG6xxbXc%l+iydb1-dFvaON<6_!)dvbih=>AdUJx&!AQd%y=Zx*~W;0dg zT_x)Bw`S%$w$J(eKfm*xW1pF|_wiH5Y~M1L9k*fn#)GNBlq97dHH=g$rPI4W?{HBm zA%`nurC7ROQculSr2=~*l~=x*Vow!Lu(|yA3OjOdUa zHY+j&NAs;qes=>ovFw#5&tdEgiq9CXwQRXovub%=6+7+Pj6U<+*L1ZsG9q2EM4e2x zO0V3y+R%nxRSqwcqpIW9x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`V5kNN+4CRhUj5C8!X009sH0T2KI5C8!X0D Date: Fri, 23 May 2025 10:16:25 +0200 Subject: [PATCH 06/66] =?UTF-8?q?Initialisation=20de=20docker=20avec=20l'i?= =?UTF-8?q?mpl=C3=A9mentation=20du=20dockerfile=20et=20du=20dockerignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 12 ++++++++++++ .gitignore | 4 +++- Dockerfile | 21 +++++++++++++++++++++ oc_lettings_site/settings.py | 4 +++- oc_lettings_site/urls.py | 5 ++++- requirements.txt | Bin 930 -> 968 bytes 6 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..5861d88595 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +**/__pycache__ +*.pyc +venv +.venv +.pytest_cache +oc-lettings-site.sqlite3 +.env +.git +.gitignore +.coverage +staticfiles/ + diff --git a/.gitignore b/.gitignore index 0b3e2d5d07..a27a720513 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ venv .venv .pytest_cache oc-lettings-site.sqlite3 -.env \ No newline at end of file +.env +.coverage +staticfiles/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..d2d43fbc50 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.11-slim + + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 + +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"] \ No newline at end of file diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 671bfe6d10..85b8b711a0 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -26,7 +26,7 @@ # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "fp$9^593hsriajg$_%=5trot9g!1qa@ew(o-1#@=&4%=hp46(s" +SECRET_KEY = os.getenv("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False @@ -49,6 +49,7 @@ MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", + 'whitenoise.middleware.WhiteNoiseMiddleware', "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", @@ -132,3 +133,4 @@ os.path.join(BASE_DIR, "static"), ] +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' \ No newline at end of file diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index 777a6e178a..d3733e8ae0 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -1,6 +1,7 @@ from django.contrib import admin from django.urls import include, path - +from django.conf import settings +from django.conf.urls.static import static from oc_lettings_site import views as core_view urlpatterns = [ @@ -11,3 +12,5 @@ path('test500', core_view.test_500), path("sentry-error/", core_view.test_error), ] + +urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9de4482c3c0a12f4275fda62f2272310c48ac244..23a3113925e8e689a704aa0ab46e860d8ca31b8f 100644 GIT binary patch delta 46 wcmZ3)eu90&B4)L6h75*Gh7yKUhCGIRAgdV2vIRmj20aE#AU0s&W#D1}01W#GzW@LL delta 7 OcmX@XzKDIpB4z*#Mgq Date: Tue, 27 May 2025 11:15:13 +0200 Subject: [PATCH 07/66] Ajout du fichier CI pipeline pour l'automatisation des test, et pour construire l'image docker --- .dockerignore | 1 - .github/workflows/CI.yml | 42 ++++++++++++++++++++++++++++++++++++ lettings/models.py | 7 ++++-- lettings/tests.py | 24 ++++++++++----------- lettings/views.py | 3 ++- oc_lettings_site/settings.py | 11 ++++------ oc_lettings_site/urls.py | 4 +--- oc_lettings_site/views.py | 9 -------- profiles/apps.py | 1 + profiles/models.py | 1 + profiles/tests.py | 15 +++++++------ profiles/views.py | 3 ++- 12 files changed, 78 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/CI.yml diff --git a/.dockerignore b/.dockerignore index 5861d88595..724097e931 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,7 +4,6 @@ venv .venv .pytest_cache oc-lettings-site.sqlite3 -.env .git .gitignore .coverage diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000000..06c2ede75d --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,42 @@ +name : CI pipeline + +on: + push: + branches : + - feature/refactor-apps + pull_request: + +jobs: + test-lint-build: + runs-on: ubuntu-latest + + + 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: Build Docker + run: | + echo "Building Docker image..." + docker build -t my-django-app . \ No newline at end of file diff --git a/lettings/models.py b/lettings/models.py index b35c00e0e0..c8004b1efc 100644 --- a/lettings/models.py +++ b/lettings/models.py @@ -2,13 +2,14 @@ from django.db import models -class Address(models.Model): +class Address(models.Model): """ Représente une adresse postale complète. Contient les informations nécessaires pour identifier un lieu : - numéro, rue, ville, état, code postal du pays. + numéro, rue, ville, état, code postal du pays. """ + number = models.PositiveIntegerField(validators=[MaxValueValidator(9999)]) street = models.CharField(max_length=64) city = models.CharField(max_length=64) @@ -17,6 +18,7 @@ class Address(models.Model): country_iso_code = models.CharField( max_length=3, validators=[MinLengthValidator(3)] ) + class Meta: verbose_name_plural = "Addresses" @@ -34,6 +36,7 @@ class Letting(models.Model): Contient un titre descriptif et une relation vers une adresse unique associée à cette location. """ + title = models.CharField(max_length=256) address = models.OneToOneField(Address, on_delete=models.CASCADE) diff --git a/lettings/tests.py b/lettings/tests.py index 639cf3138d..68e075a998 100644 --- a/lettings/tests.py +++ b/lettings/tests.py @@ -3,7 +3,6 @@ from .models import Address, Letting - class LettingsViewsTests(TestCase): """ Tests unitaires des vues de l'application Lettings. @@ -11,6 +10,7 @@ class LettingsViewsTests(TestCase): Vérifie que les pages de liste et de détail des locations répondent correctement et affichent les bonnes informations. """ + def setUp(self): """ Initialise les données de test : une adresse et une location. @@ -20,33 +20,31 @@ def setUp(self): """ self.address = Address.objects.create( number=123, - street='Main street', - city='Miami', - state='Florida', + street="Main street", + city="Miami", + state="Florida", zip_code=98210, - country_iso_code='USA', + country_iso_code="USA", ) - self.letting = Letting.objects.create( - title='House', - address=self.address - ) + self.letting = Letting.objects.create(title="House", address=self.address) + def test_lettings_index_view(self): """ Vérifie que la page d’index des locations retourne un code 200 et contient le titre de la location. """ - url = reverse('lettings:index') + url = reverse("lettings:index") response = self.client.get(url) self.assertEqual(response.status_code, 200) - self.assertContains(response, 'House') + self.assertContains(response, "House") def test_lettings_detail_view(self): """ Vérifie que la page de détail d’une location retourne un code 200 et contient l’adresse de la location. """ - url = reverse('lettings:letting', args=[self.letting.id]) + url = reverse("lettings:letting", args=[self.letting.id]) response = self.client.get(url) self.assertEqual(response.status_code, 200) - self.assertContains(response, 'Main street') + self.assertContains(response, "Main street") diff --git a/lettings/views.py b/lettings/views.py index e2de233775..0e12b80d78 100644 --- a/lettings/views.py +++ b/lettings/views.py @@ -7,6 +7,7 @@ logger = logging.getLogger(__name__) + def index(request): """ Affiche la liste de toutes les locations. @@ -32,7 +33,7 @@ def letting(request, letting_id): except Letting.DoesNotExist: logger.error(f"Letting non trouvé pout l'ID : {letting_id}") raise Http404("Letting non trouvé") - + context = { "title": letting.title, "address": letting.address, diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 85b8b711a0..61f61050a5 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -1,6 +1,5 @@ import os import sentry_sdk -from sentry_sdk.integrations.django import DjangoIntegration from pathlib import Path from dotenv import load_dotenv @@ -8,8 +7,6 @@ load_dotenv() - - sentry_sdk.init( dsn=os.getenv("SENTRY_DSN"), # Add data like request headers and IP for users, @@ -31,12 +28,12 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False -ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] +ALLOWED_HOSTS = ["127.0.0.1", "localhost"] # Application definition -INSTALLED_APPS = [ +INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", @@ -49,7 +46,7 @@ MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", - 'whitenoise.middleware.WhiteNoiseMiddleware', + "whitenoise.middleware.WhiteNoiseMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", @@ -133,4 +130,4 @@ os.path.join(BASE_DIR, "static"), ] -STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' \ No newline at end of file +STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage" diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index d3733e8ae0..cf37754432 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -9,8 +9,6 @@ path("lettings/", include("lettings.urls", namespace="lettings")), path("profiles/", include("profiles.urls", namespace="profiles")), path("admin/", admin.site.urls), - path('test500', core_view.test_500), - path("sentry-error/", core_view.test_error), ] -urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file +urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/oc_lettings_site/views.py b/oc_lettings_site/views.py index 41d1a2fe4d..0c84243fd0 100644 --- a/oc_lettings_site/views.py +++ b/oc_lettings_site/views.py @@ -1,5 +1,4 @@ from django.shortcuts import render -from django.http import HttpResponse def index(request): @@ -9,11 +8,3 @@ def index(request): Rend le template 'index.html' sans contexte particulier. """ return render(request, "index.html") - - -def test_500(request): - raise Exception('Erreur de pour le 500') - - -def test_error(request): - division_by_zero = 1 / 0 \ No newline at end of file diff --git a/profiles/apps.py b/profiles/apps.py index 5be32ceb5f..b2e500858e 100644 --- a/profiles/apps.py +++ b/profiles/apps.py @@ -8,4 +8,5 @@ class ProfilesConfig(AppConfig): Cette configuration permet à Django de reconnaître et initialiser l'application lors du démarrage du projet. """ + name = "profiles" diff --git a/profiles/models.py b/profiles/models.py index b05f3e07e4..4cd30a5182 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -9,6 +9,7 @@ class Profile(models.Model): Ce modèle permet de stocker des informations client telles que le nom d'utilisateur et la ville favorite. """ + user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile") favorite_city = models.CharField(max_length=64, blank=True) diff --git a/profiles/tests.py b/profiles/tests.py index 0edf2b0571..0a8e656a45 100644 --- a/profiles/tests.py +++ b/profiles/tests.py @@ -11,29 +11,32 @@ class ProfilesTests(TestCase): Vérifie que les pages de liste et de détail des profils répondent correctement et affichent les bonnes informations. """ + def setUp(self): """ Initialise un utilisateur et son profil associé pour les tests. Crée un utilisateur nommé 'dan' et un profil avec Paris comme ville favorite. """ - self.user = User.objects.create_user(username="dan", password='1234') - self.profile = Profile.objects.create(user=self.user, favorite_city='Paris') + self.user = User.objects.create_user(username="dan", password="1234") + self.profile = Profile.objects.create(user=self.user, favorite_city="Paris") def test_profile_index_view(self): """ Vérifie que la page d’index des profils retourne un code 200 et contient le mot 'Profiles'. """ - response = self.client.get(reverse('profiles:index')) + response = self.client.get(reverse("profiles:index")) self.assertEqual(response.status_code, 200) - self.assertContains(response, 'Profiles') + self.assertContains(response, "Profiles") def test_profile_detail_view(self): """ Vérifie que la page de détail d’un profil retourne un code 200 et contient la ville favorite du profil. """ - response = self.client.get(reverse('profiles:profile', args=[self.user.username])) + response = self.client.get( + reverse("profiles:profile", args=[self.user.username]) + ) self.assertEqual(response.status_code, 200) - self.assertContains(response, 'Paris') \ No newline at end of file + self.assertContains(response, "Paris") diff --git a/profiles/views.py b/profiles/views.py index 8b714dd1d1..aedd4478ea 100644 --- a/profiles/views.py +++ b/profiles/views.py @@ -8,6 +8,7 @@ logger = logging.getLogger(__name__) + def index(request): """ Affiche la liste de tous les profils clients. @@ -34,6 +35,6 @@ def profile(request, username): except Profile.DoesNotExist: logger.error(f"Profile introuvable pour l'utilisateur: {username}") raise Http404("profile non trouvé") - + context = {"profile": profile} return render(request, "profiles/profile.html", context) From 5e8278053f878378a00839d9ca6fa6377047dba0 Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 27 May 2025 11:25:50 +0200 Subject: [PATCH 08/66] Ajout de secret_key dans le pipeline CI --- .github/workflows/CI.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 06c2ede75d..e235c23925 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -32,6 +32,9 @@ jobs: flake8 . - name: Run tests with pytest + env: + SECRET_KEY: ${{ secrets.SECRET_KEY }} + SENTRY_KEY: ${{ secrets.SENTRY_KEY }} run: | echo "Running tests ..." pytest From 8ce629698e5ce97ac41498c7819c1baf8ee591cd Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 27 May 2025 11:53:41 +0200 Subject: [PATCH 09/66] Ajout des variables envs dans le dockerfile et le build docker du CI pipeline --- .github/workflows/CI.yml | 5 ++++- Dockerfile | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e235c23925..aa7b9c2610 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -42,4 +42,7 @@ jobs: - name: Build Docker run: | echo "Building Docker image..." - docker build -t my-django-app . \ No newline at end of file + docker build \ + --build-arg SECRET_KEY=${{secrets.SECRET_KEY}} + --build-arg SENTRY_KEY=${{secrets.SENTRY_KEY}} + -t my-django-app . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d2d43fbc50..d27262e3fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,10 @@ COPY . /app/ RUN pip install --no-cache-dir --upgrade pip setuptools wheel RUN pip install --no-cache-dir -r requirements.txt +ARG SECRET_KEY +ENV SECRET_KEY=${SECRET_KEY} +ARG SENTRY_KEY +ENV SENTRY_KEY=${SENTRY_KEY} RUN python manage.py collectstatic --noinput From 0544fcc997be987734537a645a77bdf28d37eeb1 Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 27 May 2025 11:56:58 +0200 Subject: [PATCH 10/66] Modifications syntaxe dockerfile --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index aa7b9c2610..a962087597 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -43,6 +43,6 @@ jobs: run: | echo "Building Docker image..." docker build \ - --build-arg SECRET_KEY=${{secrets.SECRET_KEY}} - --build-arg SENTRY_KEY=${{secrets.SENTRY_KEY}} + --build-arg SECRET_KEY=${{ secrets.SECRET_KEY }} \ + --build-arg SENTRY_KEY=${{ secrets.SENTRY_KEY }} \ -t my-django-app . \ No newline at end of file From a6963336f0a3ab781cd72f607cdb6a4ce45f8834 Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 27 May 2025 12:02:05 +0200 Subject: [PATCH 11/66] Fix --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a962087597..90af5eb2b1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,4 +1,4 @@ -name : CI pipeline +name: CI pipeline on: push: From 7d8fb2ff551be22ec13b84ae20f47fdf0310fdbd Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 27 May 2025 14:30:13 +0200 Subject: [PATCH 12/66] Modification structure CI pipeline et Dockerfile --- .github/workflows/CI.yml | 10 +++++++++- Dockerfile | 6 ------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 90af5eb2b1..e346c08f45 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -45,4 +45,12 @@ jobs: docker build \ --build-arg SECRET_KEY=${{ secrets.SECRET_KEY }} \ --build-arg SENTRY_KEY=${{ secrets.SENTRY_KEY }} \ - -t my-django-app . \ No newline at end of file + -t my-django-app . + + - name: Run collectstatic in container + run: | + docker run --rm + -e SECRET_KEY=${{ secrets.SECRET_KEY }} \ + -v ${{ github.workspace }}/static:/app/static \ + my-django-app \ + python manage.py collectstatic --noinput \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d27262e3fc..9a914c8204 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,12 +12,6 @@ COPY . /app/ RUN pip install --no-cache-dir --upgrade pip setuptools wheel RUN pip install --no-cache-dir -r requirements.txt -ARG SECRET_KEY -ENV SECRET_KEY=${SECRET_KEY} -ARG SENTRY_KEY -ENV SENTRY_KEY=${SENTRY_KEY} - -RUN python manage.py collectstatic --noinput EXPOSE 8000 From cc5d9fdf5a580360fc58a498059b67845bc33de2 Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 27 May 2025 14:34:00 +0200 Subject: [PATCH 13/66] Fix syntaxe --- .github/workflows/CI.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e346c08f45..f010b31f9b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -43,14 +43,14 @@ jobs: run: | echo "Building Docker image..." docker build \ - --build-arg SECRET_KEY=${{ secrets.SECRET_KEY }} \ - --build-arg SENTRY_KEY=${{ secrets.SENTRY_KEY }} \ + --build-arg SECRET_KEY="${{ secrets.SECRET_KEY }}" \ + --build-arg SENTRY_KEY="${{ secrets.SENTRY_KEY }}" \ -t my-django-app . - name: Run collectstatic in container run: | docker run --rm - -e SECRET_KEY=${{ secrets.SECRET_KEY }} \ + -e SECRET_KEY="${{ secrets.SECRET_KEY }}" \ -v ${{ github.workspace }}/static:/app/static \ my-django-app \ python manage.py collectstatic --noinput \ No newline at end of file From e0c85423dc5c43ac8501b9923b2ac941cb8631cf Mon Sep 17 00:00:00 2001 From: assakali Date: Tue, 27 May 2025 14:38:30 +0200 Subject: [PATCH 14/66] Fix syntaxe --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f010b31f9b..2805949b57 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -49,7 +49,7 @@ jobs: - name: Run collectstatic in container run: | - docker run --rm + docker run --rm \ -e SECRET_KEY="${{ secrets.SECRET_KEY }}" \ -v ${{ github.workspace }}/static:/app/static \ my-django-app \ From d71b5d7cc5837f6c23c5cf7e06983617aff8e9bb Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 11:44:33 +0200 Subject: [PATCH 15/66] Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2805949b57..6c3a6f7213 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,11 +5,18 @@ on: 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 @@ -31,26 +38,28 @@ jobs: echo "Running flake8 with setup.cfg" flake8 . - - name: Run tests with pytest - env: - SECRET_KEY: ${{ secrets.SECRET_KEY }} - SENTRY_KEY: ${{ secrets.SENTRY_KEY }} + - name: Run tests with pytest run: | echo "Running tests ..." pytest + - name: Generate static assets + run: | + echo "Running collectstatic in CI" + python manage.py collectstatic --noinput + + + - name: Docker login + run: | + echo "${{ secrets.DOCKER_PASSWORD }}" \ + | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + - name: Build Docker run: | echo "Building Docker image..." - docker build \ - --build-arg SECRET_KEY="${{ secrets.SECRET_KEY }}" \ - --build-arg SENTRY_KEY="${{ secrets.SENTRY_KEY }}" \ - -t my-django-app . + docker build \ + -t ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest \ + . + docker push ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest - - name: Run collectstatic in container - run: | - docker run --rm \ - -e SECRET_KEY="${{ secrets.SECRET_KEY }}" \ - -v ${{ github.workspace }}/static:/app/static \ - my-django-app \ - python manage.py collectstatic --noinput \ No newline at end of file + \ No newline at end of file From c668d613704d4f9779cb06569be845669936ceeb Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 11:50:00 +0200 Subject: [PATCH 16/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6c3a6f7213..36fe8a9b7b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -52,7 +52,7 @@ jobs: - name: Docker login run: | echo "${{ secrets.DOCKER_PASSWORD }}" \ - | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: Build Docker run: | From b762b3e53e180f7d1f6dd9a90cf40b2192703576 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 11:51:41 +0200 Subject: [PATCH 17/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 36fe8a9b7b..0a1fb2b18a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -51,8 +51,8 @@ jobs: - name: Docker login run: | - echo "${{ secrets.DOCKER_PASSWORD }}" \ - | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + echo "${{ secrets.DOCKER_PASSWORD }}" | \ + docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: Build Docker run: | From 70785b2277151007d8f8340060484cb2b4618318 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 12:01:46 +0200 Subject: [PATCH 18/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0a1fb2b18a..f193e6a417 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,6 +7,7 @@ on: pull_request: branches : - feature/refactor-apps + workflow_dispatch: jobs: test-lint-build: @@ -51,8 +52,8 @@ jobs: - name: Docker login run: | - echo "${{ secrets.DOCKER_PASSWORD }}" | \ - docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + echo "${{ DOCKER_PASSWORD }}" | \ + docker login -u "${{ DOCKER_USERNAME }}" --password-stdin - name: Build Docker run: | From b936cfece79af4136ef40d6ae130f061f5330e22 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 12:14:45 +0200 Subject: [PATCH 19/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f193e6a417..d07ae3d109 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,7 +7,7 @@ on: pull_request: branches : - feature/refactor-apps - workflow_dispatch: + jobs: test-lint-build: @@ -51,9 +51,9 @@ jobs: - name: Docker login - run: | - echo "${{ DOCKER_PASSWORD }}" | \ - docker login -u "${{ DOCKER_USERNAME }}" --password-stdin + run: docker login \ + -u "$DOCKER_USERNAME" \ + -p "$DOCKER_PASSWORD" - name: Build Docker run: | From ede48e7820d6a6354c5e36f6eb70b06d8ebcac9b Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 12:19:06 +0200 Subject: [PATCH 20/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d07ae3d109..8b89cc9a3a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -51,9 +51,11 @@ jobs: - name: Docker login - run: docker login \ - -u "$DOCKER_USERNAME" \ - -p "$DOCKER_PASSWORD" + run: | + echo "$DOCKER_PASSWORD" \ + | docker login docker.io \ + --username "$DOCKER_USERNAME" \ + --password-stdin - name: Build Docker run: | From 83f57473270d2771bc19eccad7ea8c25b0fb39e8 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 12:25:38 +0200 Subject: [PATCH 21/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8b89cc9a3a..21ed082254 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -51,18 +51,18 @@ jobs: - name: Docker login - run: | - echo "$DOCKER_PASSWORD" \ - | docker login docker.io \ - --username "$DOCKER_USERNAME" \ - --password-stdin + uses: docker/login-action@v2 + with: + registry: docker.io + username: ${{ env.DOCKER_USERNAME }} + password: ${{ env.DOCKER_PASSWORD }} - name: Build Docker - run: | - echo "Building Docker image..." - docker build \ - -t ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest \ - . - docker push ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest + uses: docker/build-push-action@v3 + with: + context: . + push: True + tags: | + ${{ env.DOCKER_USERNAME }}/my-django-app:latest \ No newline at end of file From 937a8b77d59c4cf688d3e581428f79d406eabb18 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 12:28:18 +0200 Subject: [PATCH 22/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 21ed082254..df627c7c1b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -60,9 +60,8 @@ jobs: - name: Build Docker uses: docker/build-push-action@v3 with: - context: . - push: True - tags: | - ${{ env.DOCKER_USERNAME }}/my-django-app:latest + context: . + push: true + tags: ${{ env.DOCKER_USERNAME }}/my-django-app:latest \ No newline at end of file From 5e7b984b5bd2a0dfda69930e9da0bedaaee9a5d5 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 12:33:50 +0200 Subject: [PATCH 23/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index df627c7c1b..cf4f418eb1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -54,8 +54,8 @@ jobs: uses: docker/login-action@v2 with: registry: docker.io - username: ${{ env.DOCKER_USERNAME }} - password: ${{ env.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker uses: docker/build-push-action@v3 From 46648c9ccfe254013ada01291cec0027f6697a88 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 13:47:14 +0200 Subject: [PATCH 24/66] [DEBUG]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cf4f418eb1..1f5eb7ed7a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,6 +48,11 @@ jobs: run: | echo "Running collectstatic in CI" python manage.py collectstatic --noinput + + - name: Debug Docker secrets + run: | + echo "DOCKER_USERNAME=[${{ secrets.DOCKER_USERNAME }}]" + echo "DOCKER_PASSWORD=[${{ secrets.DOCKER_PASSWORD }}]" - name: Docker login @@ -62,6 +67,6 @@ jobs: with: context: . push: true - tags: ${{ env.DOCKER_USERNAME }}/my-django-app:latest + tags: ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest \ No newline at end of file From 3431f630327b763bc6b92ebd8100c0b69f184014 Mon Sep 17 00:00:00 2001 From: assakali Date: Wed, 28 May 2025 13:50:41 +0200 Subject: [PATCH 25/66] [FIX]Isolation des variables env de l'image docker --- .github/workflows/CI.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1f5eb7ed7a..4e0af9e247 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -47,12 +47,7 @@ jobs: - name: Generate static assets run: | echo "Running collectstatic in CI" - python manage.py collectstatic --noinput - - - name: Debug Docker secrets - run: | - echo "DOCKER_USERNAME=[${{ secrets.DOCKER_USERNAME }}]" - echo "DOCKER_PASSWORD=[${{ secrets.DOCKER_PASSWORD }}]" + python manage.py collectstatic --noinput - name: Docker login From 3760c600288ce2540f3f5e7c5356de2d4971c35c Mon Sep 17 00:00:00 2001 From: assakali Date: Thu, 29 May 2025 11:30:50 +0200 Subject: [PATCH 26/66] MAJ fichier requirements.txt --- requirements.txt | Bin 968 -> 1004 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/requirements.txt b/requirements.txt index 23a3113925e8e689a704aa0ab46e860d8ca31b8f..4a1ca27b5d4ca15421e4255194e87a44b2014a37 100644 GIT binary patch delta 40 tcmX@X{)T;n3Zry7Ln%WZLncEqLq0U0RYY62-5%n delta 12 TcmaFEeu9023gc!E#wAPuALax) From 49e498be252968312e0331c96313096958991eab Mon Sep 17 00:00:00 2001 From: assakali Date: Thu, 29 May 2025 11:48:03 +0200 Subject: [PATCH 27/66] =?UTF-8?q?MAJ=20h=C3=B4te=20de=20l'application?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oc_lettings_site/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 61f61050a5..d22161d9c3 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -28,8 +28,8 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False -ALLOWED_HOSTS = ["127.0.0.1", "localhost"] - +ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "127.0.0.1,localhost").split(",") +# ["127.0.0.1", "localhost"] # Application definition From f20ee9fce521cde4c632c1416bd1bfd03c788d08 Mon Sep 17 00:00:00 2001 From: assakali Date: Thu, 29 May 2025 11:50:19 +0200 Subject: [PATCH 28/66] =?UTF-8?q?MAJ=20h=C3=B4te=20de=20l'application?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oc_lettings_site/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index d22161d9c3..871a7708d6 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -28,7 +28,7 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False -ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "127.0.0.1,localhost").split(",") +ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "127.0.0.1,localhost").split(",") # ["127.0.0.1", "localhost"] # Application definition From 0f2ec210595d21f6e50ca9051a2835d3e09a758a Mon Sep 17 00:00:00 2001 From: assakali Date: Thu, 29 May 2025 14:23:31 +0200 Subject: [PATCH 29/66] Changement du collectstatic dans le dockerfile au lieu du .yml --- .github/workflows/CI.yml | 7 +------ Dockerfile | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4e0af9e247..1848b7ef89 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -42,12 +42,7 @@ jobs: - name: Run tests with pytest run: | echo "Running tests ..." - pytest - - - name: Generate static assets - run: | - echo "Running collectstatic in CI" - python manage.py collectstatic --noinput + pytest - name: Docker login diff --git a/Dockerfile b/Dockerfile index 9a914c8204..7505514b40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ 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 From 744b62256603609c0e5b2fe3653d09851134128e Mon Sep 17 00:00:00 2001 From: assakali Date: Fri, 30 May 2025 11:22:03 +0200 Subject: [PATCH 30/66] FIX: collectstatic en production --- oc_lettings_site/settings.py | 2 +- oc_lettings_site/urls.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 871a7708d6..94fb54cb5a 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -130,4 +130,4 @@ os.path.join(BASE_DIR, "static"), ] -STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage" +STATICFILES_STORAGE = "whitenoise.storage.CompressedStaticFilesStorage" diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index cf37754432..d54e1c4c06 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -11,4 +11,4 @@ path("admin/", admin.site.urls), ] -urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + From bebe7a44c041811e68d9726a221483eb2d9cf7d4 Mon Sep 17 00:00:00 2001 From: assakali Date: Fri, 30 May 2025 11:23:48 +0200 Subject: [PATCH 31/66] FIX: collectstatic en production --- oc_lettings_site/urls.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index d54e1c4c06..a209f03da6 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -1,7 +1,5 @@ from django.contrib import admin from django.urls import include, path -from django.conf import settings -from django.conf.urls.static import static from oc_lettings_site import views as core_view urlpatterns = [ @@ -10,5 +8,3 @@ path("profiles/", include("profiles.urls", namespace="profiles")), path("admin/", admin.site.urls), ] - - From 64308612ef28c4ef59d6ae33501c0900a1083661 Mon Sep 17 00:00:00 2001 From: assakali Date: Fri, 30 May 2025 12:15:10 +0200 Subject: [PATCH 32/66] FIX: collectstatic en production --- .dockerignore | 2 +- oc_lettings_site/settings.py | 2 ++ static/css/styles.css | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 724097e931..bc2d885834 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,4 +8,4 @@ oc-lettings-site.sqlite3 .gitignore .coverage staticfiles/ - +oc_lettings_site\storage.py diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 94fb54cb5a..5042f3a07e 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -28,6 +28,7 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False + ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "127.0.0.1,localhost").split(",") # ["127.0.0.1", "localhost"] @@ -130,4 +131,5 @@ os.path.join(BASE_DIR, "static"), ] + STATICFILES_STORAGE = "whitenoise.storage.CompressedStaticFilesStorage" diff --git a/static/css/styles.css b/static/css/styles.css index 53c1b18d5f..83a4966aa2 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -18600,11 +18600,11 @@ body { } .card-waves .card-body { - background-image: url("../assets/img/backgrounds/bg-waves.svg"); + /*background-image: url("../assets/img/backgrounds/bg-waves.svg");*/ } .card-angles .card-body { - background-image: url("../assets/img/backgrounds/bg-angles.svg"); + /*background-image: url("../assets/img/backgrounds/bg-angles.svg");*/ } .card-flag { @@ -20057,7 +20057,7 @@ section { .device[data-device=iPhoneX][data-orientation=portrait][data-color=black] { padding-bottom: 198.89807163%; - background-image: url("../assets/img/device-mockups/iPhoneX/portrait.png"); + /*background-image: url("../assets/img/device-mockups/iPhoneX/portrait.png");*/ z-index: initial; } @@ -20072,7 +20072,7 @@ section { .device[data-device=iPhoneX][data-orientation=landscape][data-color=black] { padding-bottom: 50.27700831%; - background-image: url("../assets/img/device-mockups/iPhoneX/landscape.png"); + /*background-image: url("../assets/img/device-mockups/iPhoneX/landscape.png");*/ z-index: initial; } @@ -20098,7 +20098,7 @@ section { .device[data-device=iPhoneX][data-orientation=portrait][data-color=black]::after { content: ""; - background-image: url("../assets/img/device-mockups/iPhoneX/portrait_black.png"); + /*background-image: url("../assets/img/device-mockups/iPhoneX/portrait_black.png");*/ } .device[data-device=iPhoneX][data-orientation=portrait][data-color=black] .button { @@ -20122,7 +20122,7 @@ section { .device[data-device=iPhoneX][data-orientation=landscape][data-color=black]::after { content: ""; - background-image: url("../assets/img/device-mockups/iPhoneX/landscape_black.png"); + /*background-image: url("../assets/img/device-mockups/iPhoneX/landscape_black.png");*/ } .device[data-device=iPhoneX][data-orientation=landscape][data-color=black] .button { From a53aa0bba980fa17e69f3cf54e4bf871c73f2880 Mon Sep 17 00:00:00 2001 From: assakali Date: Fri, 30 May 2025 12:19:15 +0200 Subject: [PATCH 33/66] DEBUG: collectstatic en production --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7505514b40..d0fc42a9d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ 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 +RUN python manage.py collectstatic --noinput --verbosity 2 EXPOSE 8000 From 40a309de610b804555039a104faabecdc6217661 Mon Sep 17 00:00:00 2001 From: assakali Date: Fri, 30 May 2025 12:31:50 +0200 Subject: [PATCH 34/66] FIX: collectstatic en production --- Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d0fc42a9d9..d577bc0140 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,13 @@ FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 \ - PYTHONUNBUFFERED=1 + PYTHONUNBUFFERED=1\ + DEBUG=False \ + DJANGO_SETTINGS_MODULE=oc_lettings_site.settings + + +ARG SECRET_KEY=xtokenforbuildonly +ENV SECRET_KEY=${SECRET_KEY} WORKDIR /app @@ -12,7 +18,7 @@ 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 --verbosity 2 +RUN python manage.py collectstatic --noinput EXPOSE 8000 From 43e388b1d324447cdaead68d55e86c969ca6f864 Mon Sep 17 00:00:00 2001 From: assakali Date: Fri, 30 May 2025 12:39:15 +0200 Subject: [PATCH 35/66] =?UTF-8?q?Ajout=20de=20la=20base=20de=20donn=C3=A9e?= =?UTF-8?q?=20pour=20le=20d=C3=A9ploiement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 1 - .gitignore | 1 - oc-lettings-site.sqlite3 | Bin 0 -> 180224 bytes 3 files changed, 2 deletions(-) create mode 100644 oc-lettings-site.sqlite3 diff --git a/.dockerignore b/.dockerignore index bc2d885834..3d91f41c50 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,7 +3,6 @@ venv .venv .pytest_cache -oc-lettings-site.sqlite3 .git .gitignore .coverage diff --git a/.gitignore b/.gitignore index a27a720513..0a232bd8d6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ venv .venv .pytest_cache -oc-lettings-site.sqlite3 .env .coverage staticfiles/ \ No newline at end of file diff --git a/oc-lettings-site.sqlite3 b/oc-lettings-site.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..57ba9704eda6f2d6ff66c424a974d9ae1066ff47 GIT binary patch literal 180224 zcmeI5dvF}decxyHfyH7UO%Mc^Jd%e2KoHym0nF?RyEyUg7R2H~0w4*32ZHu_Yp^?5 z47s}l&dlP$^En3ZPA)69T$W`;QYyBSipyn3sgj&3DOFai=oCw`QzgYNS&1Uai7h9V zoXC<@KIsq1mHfJQ_K5|_Yv>9;I2ce;Q5>u-O$r+2$&cKXWYIn`8zHBB$brV!>1 za6HdFCkPzJO~Kz8`0IneHuzhDKL`9(UVP=vUH+fqMl!q;3~c24)NF|Su>9sOc`ykH zAOR$R1dsp{Kmter2_OL^fCP{L5_nhy0x|H^9q>UI=s3%f&yf$1Ea~-s+5b!a3Ew~Z z{=m28i+KOW`j!(@hX_(3ke_rB!C2v01`j~NZ==tz*NA= z4L_aKGU>cxnrbm;qz$;5B#L4vEtgC!9TG!PF)BsVQdo-7gJCf`EJX!L8kb_@;n+wl z8j&FSu#-CxOm67fnwnP(mOrCy?4+}@Dc5Hc$3v0vh%^$9k4e&4xErz!)Mt~@YEd;+ zIo~=Hl$3}bVr5kX-$z+vp-^-z+{MbO%Xas&Vp1#;4IgBg48<^1tw`%tpGh1RW5ZHJ z5EJ9!=y)_T5)MV;(fHGy0Ck`h)VpUEBjLFC+yN)oJ)H#j>rj}KE^PopB@JY^chVb* zUQo+YfX|-dL-A-hBAz4QVZP!)Ov`yw(bG9yD{Z8UazRNK3s>Vrj;>T3#p@kWZ}%feN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5&Mtu0`P9PF8KG}Y-qdueCZn1= zeF8i)D6=l>r(=;|HGlAqJ?RPz5A!c4SZyrbMx_GH$H7L;&B>2SCRCg-M#a$VksF%r4C)=jK+d$kb%;*@?Emm0_M! zi&q<(bMgbVhpC!*rPf_S(O9j&KtsscEL^WK?z=6jnyifX*(7(io?#$f?QH~M zd1>}~Y9A1dg}$-#r&ubi(k@gv>EMA?YObhct7ngJZYFi^0-Tx^%V*9CVh|V^?8#g; zhV`c$B=3Jdvb?fckG}!_ZFM7^(XxMUs#Z)Z+Z%AbE}aFDX*rsSg<`RAqsf5P6tfGHscS-CV`9tv zeZs|sW<%Od>dNX1KK-t?z{TKx=V((YQseQ--PqHvKrqPP8DzbwF}3lizp*DZCQ?-u z5;v8)K{X=Q2-XkEv_UO$fK2WaOl2FMre+P_kXm0yfl@Wqf>JdI!lvlo3YHQ0Trbq%aDd5<(J{!C+Y>}U2sHMrYI2jqDz zb9TS}wnvBck&u@5OA)}~lN7|uv#mi`9`?)M-V(&_)TE1j8!7jXyMBqdYvNnoQ|R;m zxC0zV{yX_kumixWWP!wK6uyuE5D+!_LiLQgv8{GH9v^9?r?Sy1EKa^%JHQQ{Iwyj@a$o*x(g4ufb#gOIcML6wYa; ZDd&_!Hqdf0)AR(ulf0d~c+cnm{eR2uE}j4Y literal 0 HcmV?d00001 From 54a1ab6442a38f129fb4ba3ad15b94213c9a1690 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 10:26:27 +0200 Subject: [PATCH 36/66] =?UTF-8?q?D=C3=A9placement=20des=20objets=20profile?= =?UTF-8?q?s=20et=20lettinsg=20dans=20leur=20admins=20respectif?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lettings/admin.py | 7 +++++++ oc-lettings-site.sqlite3 | Bin 180224 -> 180224 bytes oc_lettings_site/admin.py | 8 -------- profiles/admin.py | 7 +++++++ requirements.txt | Bin 1004 -> 1868 bytes 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lettings/admin.py b/lettings/admin.py index e69de29bb2..4749729dc9 100644 --- a/lettings/admin.py +++ b/lettings/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin + +from .models import Address, Letting + + +admin.site.register(Letting) +admin.site.register(Address) diff --git a/oc-lettings-site.sqlite3 b/oc-lettings-site.sqlite3 index 57ba9704eda6f2d6ff66c424a974d9ae1066ff47..3501d7b50873c8361c4187108547dfa33e98ad57 100644 GIT binary patch delta 258 zcmZo@;BIK(o*>QWIZ?)$(Q{)$!h9iPLj^-4D^oKoLnA#4Gjl^D%jQe-w_lpiXw<;P z%;UzucZj!z$8BSy1&>CPH8ZPk3#+3=fl+!&W=gK5L3UC}RcS$aRk1-yZgGBoRfR=m zc2VW_HM&epj3Q>bh9*d6n;Qbn-rl0i)WF2W%s+{Ne>?vj{z;n!3tIR!RhWGl37N_a zQZ&6smq}szZF?q7pczXT_#g2f=3fFdV;aA_9J3>%k%5t^t^qcSnYSPIXR<8-05y9{ Ai2wiq delta 115 zcmV-(0F3{DfD3?t3y>QDMv)vt0Yh zGJpsI4TJy=!VQG6fp`tKge?Mq0tf;Rw*U{f58Sg6aH|glBm+$Wmy9g}AeY-e0x1Xr V55oWt;t#{K5rDT3x5G~YJ#galBgFs! diff --git a/oc_lettings_site/admin.py b/oc_lettings_site/admin.py index 574d0e56e1..e69de29bb2 100644 --- a/oc_lettings_site/admin.py +++ b/oc_lettings_site/admin.py @@ -1,8 +0,0 @@ -from django.contrib import admin - -from lettings.models import Address, Letting -from profiles.models import Profile - -admin.site.register(Letting) -admin.site.register(Address) -admin.site.register(Profile) diff --git a/profiles/admin.py b/profiles/admin.py index e69de29bb2..93000f7365 100644 --- a/profiles/admin.py +++ b/profiles/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin + + +from profiles.models import Profile + + +admin.site.register(Profile) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 4a1ca27b5d4ca15421e4255194e87a44b2014a37..610247b5138424fe4b3191274bf2b583d58d0bef 100644 GIT binary patch literal 1868 zcmbW2OK;Oq5QS%r#7_w#4lQNDjujFTQhxx-+io4(Nu0Lnj|a{-kC z%$b>+Uq9zo+uRm9N9%2E2m7qg)ZW>9KX2`g+qPE8wziGiXR_VsObt8H3)yP775@I? z7`{*D0 zS;R$ltO*;&uuI6TV#zZ1JVaA7(FwD)2hTjWt-kS~F7iZyvvu;W{8#pzxzEPcyBGS+h@WfN3Zd}|siSd^!ZpaDsw^XZs=RlQ^I$^}sl^1TVAgl!ld1JbEh?-6`90#GLxc%Fo^70;yaCDvI8 ztvW;(dim6P!Y{Tc&r>H`o`pcd$_bsm%VR6GVyeO;vV4+H;(d0FzygIyCd1XhHCrd* z^!IF&DXD~S={n=vdfrC+lB&Ga9N%ZR6PZyl?WE~aX+N0lYwPP_|y8)dlL1fQD+gmXy zeWoH`x^1EcrYTutpV<6L*(a)`(}&KNI<=nD1mrD#DW2(hcx7y<&g_KwC-S9||7U(D zW$6r)kouk#d5QDhV_s7&okh8H^T!saI{u~H-Zf4C9(cf!EsWlrl#dS6joGL@dmOX= UsOl>5WumyJVL%q{y1Ws;0d#m6IRF3v delta 41 zcmV+^0M`G^4(ta4|NfCCB9UfBk>YrhegSBcA_6|Mqyi`blkfwQliCDClja6ydvp Date: Mon, 2 Jun 2025 10:28:08 +0200 Subject: [PATCH 37/66] =?UTF-8?q?D=C3=A9placement=20des=20objets=20profile?= =?UTF-8?q?s=20et=20lettinsg=20dans=20leur=20admins=20respectif?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lettings/admin.py | 1 - lettings/tests.py | 1 + lettings/views.py | 6 ++++-- oc_lettings_site/settings.py | 4 ++-- oc_lettings_site/urls.py | 1 + profiles/admin.py | 4 +--- profiles/tests.py | 3 ++- profiles/views.py | 6 ++++-- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lettings/admin.py b/lettings/admin.py index 4749729dc9..917b65850d 100644 --- a/lettings/admin.py +++ b/lettings/admin.py @@ -2,6 +2,5 @@ from .models import Address, Letting - admin.site.register(Letting) admin.site.register(Address) diff --git a/lettings/tests.py b/lettings/tests.py index 68e075a998..ea65b4fc2f 100644 --- a/lettings/tests.py +++ b/lettings/tests.py @@ -1,5 +1,6 @@ from django.test import TestCase from django.urls import reverse + from .models import Address, Letting diff --git a/lettings/views.py b/lettings/views.py index 0e12b80d78..4d3e646a3a 100644 --- a/lettings/views.py +++ b/lettings/views.py @@ -1,7 +1,9 @@ -from django.shortcuts import render import logging -from lettings.models import Letting + from django.http import Http404 +from django.shortcuts import render + +from lettings.models import Letting # Create your views here. diff --git a/oc_lettings_site/settings.py b/oc_lettings_site/settings.py index 5042f3a07e..c424e76526 100644 --- a/oc_lettings_site/settings.py +++ b/oc_lettings_site/settings.py @@ -1,8 +1,8 @@ import os -import sentry_sdk from pathlib import Path -from dotenv import load_dotenv +import sentry_sdk +from dotenv import load_dotenv load_dotenv() diff --git a/oc_lettings_site/urls.py b/oc_lettings_site/urls.py index a209f03da6..90ec08469b 100644 --- a/oc_lettings_site/urls.py +++ b/oc_lettings_site/urls.py @@ -1,5 +1,6 @@ from django.contrib import admin from django.urls import include, path + from oc_lettings_site import views as core_view urlpatterns = [ diff --git a/profiles/admin.py b/profiles/admin.py index 93000f7365..a599326416 100644 --- a/profiles/admin.py +++ b/profiles/admin.py @@ -1,7 +1,5 @@ from django.contrib import admin - from profiles.models import Profile - -admin.site.register(Profile) \ No newline at end of file +admin.site.register(Profile) diff --git a/profiles/tests.py b/profiles/tests.py index 0a8e656a45..9d45a0a23f 100644 --- a/profiles/tests.py +++ b/profiles/tests.py @@ -1,7 +1,8 @@ +from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse + from .models import Profile -from django.contrib.auth.models import User class ProfilesTests(TestCase): diff --git a/profiles/views.py b/profiles/views.py index aedd4478ea..9be054f271 100644 --- a/profiles/views.py +++ b/profiles/views.py @@ -1,7 +1,9 @@ -from django.shortcuts import render import logging -from profiles.models import Profile + from django.http import Http404 +from django.shortcuts import render + +from profiles.models import Profile # Create your views here. From 18f3ea3be28c7c0d7f10fbc1bd915865cdf629e1 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 11:53:11 +0200 Subject: [PATCH 38/66] Ajout du fichier yml de readthedoc pour la documentation --- .readthedocs.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..d4e8c14d04 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,22 @@ +# 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.13" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/conf.py + +# 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 \ No newline at end of file From d35a11a777ba7dbb7f20c51d1ff6359973d7b2ae Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 12:57:21 +0200 Subject: [PATCH 39/66] =?UTF-8?q?Compl=C3=A9ment=20de=20la=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Makefile | 20 +++++++++++++++++ docs/make.bat | 35 +++++++++++++++++++++++++++++ docs/source/conf.py | 43 ++++++++++++++++++++++++++++++++++++ docs/source/index.rst | 19 ++++++++++++++++ docs/source/modules.rst | 16 ++++++++++++++ docs/source/presentation.rst | 11 +++++++++ 6 files changed, 144 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst create mode 100644 docs/source/modules.rst create mode 100644 docs/source/presentation.rst diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000000..d0c3cbf102 --- /dev/null +++ b/docs/Makefile @@ -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) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000000..dc1312ab09 --- /dev/null +++ b/docs/make.bat @@ -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 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000000..c2e2e8634d --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,43 @@ +import os +import sys +sys.path.insert(0, os.path.abspath('../..')) + +os.environ['DJANGO_SETTINGS_MODULE'] = 'oc_lettings_site.settings' + + +import django +django.setup() + +# 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 = "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"] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000000..d1589f5f92 --- /dev/null +++ b/docs/source/index.rst @@ -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 `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + presentation + modules \ No newline at end of file diff --git a/docs/source/modules.rst b/docs/source/modules.rst new file mode 100644 index 0000000000..983023dea0 --- /dev/null +++ b/docs/source/modules.rst @@ -0,0 +1,16 @@ +Documentation des modules +========================= + + +.. automodule:: lettings.models + :members: + + +.. automodule:: lettings.views + :members: + +.. automodule:: profiles.models + :members: + +.. automodule:: profiles.views + :members: \ No newline at end of file diff --git a/docs/source/presentation.rst b/docs/source/presentation.rst new file mode 100644 index 0000000000..5120dac87b --- /dev/null +++ b/docs/source/presentation.rst @@ -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 \ No newline at end of file From 98517ccb53574dbb36646b32b436b9c7082e2018 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 12:59:20 +0200 Subject: [PATCH 40/66] Modification chemin conf.py --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index d4e8c14d04..ca15731819 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,7 +12,7 @@ build: # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: docs/conf.py + configuration: docs/source/conf.py # Optionally, but recommended, # declare the Python requirements required to build your documentation From f677f5ed29f89f84719a078926c46805da93554f Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:03:56 +0200 Subject: [PATCH 41/66] Modification chemin conf.py --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index ca15731819..d4e8c14d04 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,7 +12,7 @@ build: # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: docs/source/conf.py + configuration: docs/conf.py # Optionally, but recommended, # declare the Python requirements required to build your documentation From 4ceb5999df3d3f2a1068ecdef69ebec6287a429e Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:06:18 +0200 Subject: [PATCH 42/66] Modification chemin conf.py --- docs/conf.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 docs/conf.py diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000000..c2e2e8634d --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,43 @@ +import os +import sys +sys.path.insert(0, os.path.abspath('../..')) + +os.environ['DJANGO_SETTINGS_MODULE'] = 'oc_lettings_site.settings' + + +import django +django.setup() + +# 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 = "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"] From bbd7963d375a2eb3e7a47ad7d3169a345d050fdc Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:09:02 +0200 Subject: [PATCH 43/66] Modification chemin conf.py --- docs/conf.py | 19 ++++++++++--------- requirements.txt | Bin 1868 -> 2012 bytes 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c2e2e8634d..144b0a8485 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,11 +1,12 @@ -import os +import os import sys -sys.path.insert(0, os.path.abspath('../..')) +import django -os.environ['DJANGO_SETTINGS_MODULE'] = 'oc_lettings_site.settings' +sys.path.insert(0, os.path.abspath("../..")) + +os.environ["DJANGO_SETTINGS_MODULE"] = "oc_lettings_site.settings" -import django django.setup() # Configuration file for the Sphinx documentation builder. @@ -21,19 +22,19 @@ author = "mehdi" - # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = ['sphinx.ext.autodoc', - 'sphinx.ext.napoleon', - ] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", +] templates_path = ["_templates"] exclude_patterns = [] language = "fr" -local_dirs = ['locales/'] +local_dirs = ["locales/"] gettex_compact = False # -- Options for HTML output ------------------------------------------------- diff --git a/requirements.txt b/requirements.txt index 610247b5138424fe4b3191274bf2b583d58d0bef..be743f5cce534fc2fb0a266dcfb9450b34931e1a 100644 GIT binary patch delta 106 zcmX@ZcZYvN8LOo(LncEWLkU9;gDnsmG3YTE1F<0kF9R1tF+%}E23Wp=L6@Njs44|W vmjK058FDB0Gl@=q#ws(pjdhQ3Awwxptcal!Y>ElUgvk$C6*oJu@h}1azBU&i delta 16 Ycmcb^e}->E8SCT=tY Date: Mon, 2 Jun 2025 13:11:10 +0200 Subject: [PATCH 44/66] Modification chemin conf.py --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 144b0a8485..0eb1f3fc7c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,6 @@ import os import sys + import django sys.path.insert(0, os.path.abspath("../..")) From 0dcc3e2316d842a05a72d6251a62f7618d960ecc Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:15:26 +0200 Subject: [PATCH 45/66] Modification chemin conf.py --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 0eb1f3fc7c..9e0b995061 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,6 @@ copyright = "2025, mehdi" author = "mehdi" - # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration From a998f7b18ec569555d1ef8a6f304f200dcb63161 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:19:06 +0200 Subject: [PATCH 46/66] Modification chemin conf.py --- docs/conf.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 9e0b995061..393c9bd356 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,13 +3,6 @@ import django -sys.path.insert(0, os.path.abspath("../..")) - -os.environ["DJANGO_SETTINGS_MODULE"] = "oc_lettings_site.settings" - - -django.setup() - # Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: @@ -18,6 +11,13 @@ # -- 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"] = "oc_lettings_site.settings" + + +django.setup() + project = "oc-lettings" copyright = "2025, mehdi" author = "mehdi" From 883a6100bf2b0357cc1487d7edc90bb5f1aabb31 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:24:09 +0200 Subject: [PATCH 47/66] =?UTF-8?q?D=C3=A9place=20conf.py=20de=20docs/source?= =?UTF-8?q?/=20vers=20docs/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/source/conf.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 docs/source/conf.py diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index c2e2e8634d..0000000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,43 +0,0 @@ -import os -import sys -sys.path.insert(0, os.path.abspath('../..')) - -os.environ['DJANGO_SETTINGS_MODULE'] = 'oc_lettings_site.settings' - - -import django -django.setup() - -# 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 = "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"] From 0a20a3175459125eab17d613b425f33743427030 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:36:38 +0200 Subject: [PATCH 48/66] Fix: chemin conf.py --- .readthedocs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index d4e8c14d04..9304568623 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -13,6 +13,8 @@ build: # Build documentation in the "docs/" directory with Sphinx sphinx: configuration: docs/conf.py + builder: html + source: docs # Optionally, but recommended, # declare the Python requirements required to build your documentation From 488287d406fc135fe7483864304ee45faddb87d6 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:39:39 +0200 Subject: [PATCH 49/66] Fix: chemin conf.py --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 9304568623..42a7510180 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,7 +14,7 @@ build: sphinx: configuration: docs/conf.py builder: html - source: docs + # Optionally, but recommended, # declare the Python requirements required to build your documentation From 44711100fafe15ef7f360044885def67b16bdd51 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:46:32 +0200 Subject: [PATCH 50/66] Fix: chemin conf.py --- .readthedocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 42a7510180..9a6b08a994 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -10,9 +10,10 @@ build: tools: python: "3.13" +docs_dir: docs/source # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: docs/conf.py + configuration: ../conf.py builder: html From abc78f489603e508707c96a19371e080ef74ed70 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:50:50 +0200 Subject: [PATCH 51/66] Fix: chemin conf.py --- .readthedocs.yml | 4 ++-- docs/{ => source}/conf.py | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename docs/{ => source}/conf.py (100%) diff --git a/.readthedocs.yml b/.readthedocs.yml index 9a6b08a994..d23c4c20b0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -10,10 +10,10 @@ build: tools: python: "3.13" -docs_dir: docs/source + # Build documentation in the "docs/" directory with Sphinx sphinx: - configuration: ../conf.py + configuration: docs/source/conf.py builder: html diff --git a/docs/conf.py b/docs/source/conf.py similarity index 100% rename from docs/conf.py rename to docs/source/conf.py From 50addf8aa9c194cadaa687b71027e68b133fdad6 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 13:56:14 +0200 Subject: [PATCH 52/66] Fix: chemin conf.py --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index d23c4c20b0..01db9daf5c 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,7 +8,7 @@ version: 2 build: os: ubuntu-24.04 tools: - python: "3.13" + python: "3.12" # Build documentation in the "docs/" directory with Sphinx From 06022b08d4bbadca7923263afd37844c1f72e8e2 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 14:06:22 +0200 Subject: [PATCH 53/66] Fix: chemin conf.py --- docs/source/conf.py | 2 +- docs/source/doc_settings.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 docs/source/doc_settings.py diff --git a/docs/source/conf.py b/docs/source/conf.py index 393c9bd356..b5d3b522dc 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,7 +13,7 @@ sys.path.insert(0, os.path.abspath("../..")) -os.environ["DJANGO_SETTINGS_MODULE"] = "oc_lettings_site.settings" +os.environ["DJANGO_SETTINGS_MODULE"] = "docs.source.doc_settings" django.setup() diff --git a/docs/source/doc_settings.py b/docs/source/doc_settings.py new file mode 100644 index 0000000000..c9b5186452 --- /dev/null +++ b/docs/source/doc_settings.py @@ -0,0 +1,20 @@ + + + + +SECRET_KEY = "clef_secrète_pour_la_doc" + + +INSTALLED_APPS = [ + "django.contrib.auth", + "django.contrib.contenttypes", + "oc_lettings_site", +] + + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": ":memory:", + } +} \ No newline at end of file From 6ee7a1c366d90fd5ce82aef165fa38eeff2f171e Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 14:22:20 +0200 Subject: [PATCH 54/66] Fix: chemin conf.py --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index b5d3b522dc..1306455d23 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,7 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -sys.path.insert(0, os.path.abspath("../..")) +sys.path.insert(0, os.path.abspath("..")) os.environ["DJANGO_SETTINGS_MODULE"] = "docs.source.doc_settings" From 64ad5c99952734fd9b437b67efa41a5c3eba395b Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 14:26:51 +0200 Subject: [PATCH 55/66] Fix: chemin conf.py --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 1306455d23..b5d3b522dc 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,7 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -sys.path.insert(0, os.path.abspath("..")) +sys.path.insert(0, os.path.abspath("../..")) os.environ["DJANGO_SETTINGS_MODULE"] = "docs.source.doc_settings" From cfa8fa5b00f8a21a336a88a32ffe60a1f0e39305 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 14:33:01 +0200 Subject: [PATCH 56/66] =?UTF-8?q?Fix:=20r=C3=A9cuperation=20objets=20profi?= =?UTF-8?q?les=20et=20lettings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/source/doc_settings.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/source/doc_settings.py b/docs/source/doc_settings.py index c9b5186452..6b91daea6c 100644 --- a/docs/source/doc_settings.py +++ b/docs/source/doc_settings.py @@ -1,7 +1,3 @@ - - - - SECRET_KEY = "clef_secrète_pour_la_doc" @@ -9,6 +5,8 @@ "django.contrib.auth", "django.contrib.contenttypes", "oc_lettings_site", + "lettings", + "profiles", ] @@ -17,4 +15,4 @@ "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", } -} \ No newline at end of file +} From d30f0db4b6a0ef79a71ebdae98d3be8aa7c65b9a Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 2 Jun 2025 14:56:56 +0200 Subject: [PATCH 57/66] =?UTF-8?q?Fix:=20r=C3=A9cuperation=20objets=20profi?= =?UTF-8?q?les=20et=20lettings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 01db9daf5c..96ec8ec420 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,7 +8,7 @@ version: 2 build: os: ubuntu-24.04 tools: - python: "3.12" + python: "3.11" # Build documentation in the "docs/" directory with Sphinx From 606aa0289a5cf133d2067aed1715a9fc565ae977 Mon Sep 17 00:00:00 2001 From: assakali Date: Thu, 26 Jun 2025 11:38:43 +0200 Subject: [PATCH 58/66] =?UTF-8?q?Mise=20=C3=A0=20jour=20du=20fichier=20et?= =?UTF-8?q?=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- README.md | 77 ++++++++++++++++++++++++++++++++++++++++++++ templates/index.html | 2 +- 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0a232bd8d6..a93ecf706a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ venv .pytest_cache .env .coverage -staticfiles/ \ No newline at end of file +staticfiles/ +build/ \ No newline at end of file diff --git a/README.md b/README.md index c8547803f7..5bc2da5535 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,80 @@ Utilisation de PowerShell, comme ci-dessus sauf : - Pour activer l'environnement virtuel, `.\venv\Scripts\Activate.ps1` - Remplacer `which ` par `(Get-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 + +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 + + + + diff --git a/templates/index.html b/templates/index.html index fc9a76c7ab..abbad066de 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@

-

Welcome to Holiday Homes

+

Welcome to Holiday Home

From 1b2b290771fdb677e2eb2392dc59a7a49bd146f2 Mon Sep 17 00:00:00 2001 From: assakali Date: Sat, 28 Jun 2025 10:27:23 +0200 Subject: [PATCH 59/66] [Test]Modification Titre de la page d'acceuil --- templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index abbad066de..fc9a76c7ab 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@
-

Welcome to Holiday Home

+

Welcome to Holiday Homes

From b8691ca2b566acc1d3b6af563a7cac87a9a2b32a Mon Sep 17 00:00:00 2001 From: assakali Date: Sat, 28 Jun 2025 14:40:36 +0200 Subject: [PATCH 60/66] Modification du titre de la page d'acceuil --- templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index fc9a76c7ab..c2d2b9d8a5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@
-

Welcome to Holiday Homes

+

Bienvenue à Holiday Homes

From 68ad9c47c44a106132f7f145b8d2b2724a5c29e9 Mon Sep 17 00:00:00 2001 From: assakali Date: Sat, 28 Jun 2025 17:07:44 +0200 Subject: [PATCH 61/66] Automatisation de deploiement render dans le pipeline CI/CD --- .github/workflows/CI.yml | 4 ++++ templates/index.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1848b7ef89..3957430469 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -59,4 +59,8 @@ jobs: push: true tags: ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest + - name: Trigger Render Deploy Hook + run: | + curl -X POST ${{secrets.RENDER_DEPLOY_HOOK}} + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index c2d2b9d8a5..a10a7c00f3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@
-

Bienvenue à Holiday Homes

+

Bienvenue à Holiday Home

From ee11ddf646d4d65522aaed133a8ffcb4dea7995a Mon Sep 17 00:00:00 2001 From: assakali Date: Sun, 29 Jun 2025 14:25:47 +0200 Subject: [PATCH 62/66] Automatisation de deploiement render dans le pipeline CI/CD --- .github/workflows/CI.yml | 3 +-- templates/index.html | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3957430469..da64bf60bb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -60,7 +60,6 @@ jobs: tags: ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest - name: Trigger Render Deploy Hook - run: | - curl -X POST ${{secrets.RENDER_DEPLOY_HOOK}} + run: curl -X POST ${{secrets.RENDER_DEPLOY_HOOK}} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index a10a7c00f3..936799ae65 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@
-

Bienvenue à Holiday Home

+

Welcom to Holiday Home

From 57bfedd740d99cbceba6dca885017dbcfb3b324f Mon Sep 17 00:00:00 2001 From: assakali Date: Sun, 29 Jun 2025 23:57:17 +0200 Subject: [PATCH 63/66] [Test] Modification titre page d'acceuil --- .github/workflows/{CI.yml => CI/CI/CI_CD.yml} | 0 README.md | 1 + templates/index.html | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) rename .github/workflows/{CI.yml => CI/CI/CI_CD.yml} (100%) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI/CI/CI_CD.yml similarity index 100% rename from .github/workflows/CI.yml rename to .github/workflows/CI/CI/CI_CD.yml diff --git a/README.md b/README.md index 5bc2da5535..9a6a691b33 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ Le projet utilise un fichier `.env` pour centraliser les variables d'environneme 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` diff --git a/templates/index.html b/templates/index.html index 936799ae65..877d0a613b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@
-

Welcom to Holiday Home

+

Welcomz to Holiday Homes

From 6a00550af6160a2b6096760129e126f842ee89e0 Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 30 Jun 2025 00:01:33 +0200 Subject: [PATCH 64/66] [Test] Modification titre page d'acceuil --- .github/workflows/CI/CI/{CI_CD.yml => CI.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/CI/CI/{CI_CD.yml => CI.yml} (100%) diff --git a/.github/workflows/CI/CI/CI_CD.yml b/.github/workflows/CI/CI/CI.yml similarity index 100% rename from .github/workflows/CI/CI/CI_CD.yml rename to .github/workflows/CI/CI/CI.yml From 8cfd5c55815dca49f0e4f5a8c3819f302571e29a Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 30 Jun 2025 00:04:50 +0200 Subject: [PATCH 65/66] [Test] Modification titre page d'acceuil --- .github/workflows/CI/CI/CI.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/CI/CI/CI.yml b/.github/workflows/CI/CI/CI.yml index da64bf60bb..c94d08dd8e 100644 --- a/.github/workflows/CI/CI/CI.yml +++ b/.github/workflows/CI/CI/CI.yml @@ -60,6 +60,4 @@ jobs: tags: ${{ secrets.DOCKER_USERNAME }}/my-django-app:latest - name: Trigger Render Deploy Hook - run: curl -X POST ${{secrets.RENDER_DEPLOY_HOOK}} - - \ No newline at end of file + run: curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK }} \ No newline at end of file From d0af34813a44b5e07ec0d0f8b1f4c8e076f09ebf Mon Sep 17 00:00:00 2001 From: assakali Date: Mon, 30 Jun 2025 00:08:16 +0200 Subject: [PATCH 66/66] [Test] Modification titre page d'acceuil --- .github/workflows/{CI/CI => }/CI.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{CI/CI => }/CI.yml (100%) diff --git a/.github/workflows/CI/CI/CI.yml b/.github/workflows/CI.yml similarity index 100% rename from .github/workflows/CI/CI/CI.yml rename to .github/workflows/CI.yml