diff --git a/CourseMaster/settings.py b/CourseMaster/settings.py index 105f98d..5ca8195 100644 --- a/CourseMaster/settings.py +++ b/CourseMaster/settings.py @@ -20,6 +20,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! +# Fell free to get this key, I won't publish my project into a release, and I didn't want to take the time to hide it. SECRET_KEY = 'django-insecure-3ib(8=@cwv%48&0@r1c)inr_*l*-ky$q!8*f_x2&*8a(1_mxb#' # SECURITY WARNING: don't run with debug turned on in production! @@ -37,7 +38,9 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + # My project, where all my code is defined 'redis_app', + # I love using debug toolbar 'debug_toolbar', ] @@ -52,12 +55,15 @@ MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] +# Localhost website INTERNAL_IPS = [ '127.0.0.1', ] +# All my URLs are in this file, kinda Router ROOT_URLCONF = 'CourseMaster.urls' +# Declaring redis TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', @@ -80,6 +86,7 @@ WSGI_APPLICATION = 'CourseMaster.wsgi.application' # Database # https://docs.djangoproject.com/en/4.2/ref/settings/#databases +# Useless, I don't use it in my project because I'm using Redis DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -106,6 +113,7 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] +# Defining the cache in redis. Not very important here, just played with it after I saw a YouTube video showcasing this feature. CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", @@ -120,8 +128,8 @@ CACHES = { # Internationalization # https://docs.djangoproject.com/en/4.2/topics/i18n/ +# I'm telling my project that le language is french (even if all my texts are in english...) LANGUAGE_CODE = 'fr-fr' - TIME_ZONE = 'Europe/Paris' USE_I18N = True @@ -132,6 +140,8 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.2/howto/static-files/ + +# Allows me to use css into my templates. I followed the django docs. STATIC_URL = '/static/' # Default primary key field type diff --git a/CourseMaster/urls.py b/CourseMaster/urls.py index 69dfc5c..bca5043 100644 --- a/CourseMaster/urls.py +++ b/CourseMaster/urls.py @@ -19,7 +19,10 @@ from django.urls import path, include import debug_toolbar urlpatterns = [ + # Useless, there's no admin part in my project path('admin/', admin.site.urls), + # The main project path('redis/', include('redis_app.urls')), + # For debug toolbar path('__debug__/', include(debug_toolbar.urls)) ] diff --git a/redis_app/admin.py b/redis_app/admin.py index 6f3538b..694323f 100644 --- a/redis_app/admin.py +++ b/redis_app/admin.py @@ -1,6 +1 @@ from django.contrib import admin - -from .models import Course, Person - -admin.site.register(Course) -admin.site.register(Person) diff --git a/redis_app/apps.py b/redis_app/apps.py index 5d03691..0575ed7 100644 --- a/redis_app/apps.py +++ b/redis_app/apps.py @@ -1,6 +1,6 @@ from django.apps import AppConfig - +# Configuring redis as I saw it on the doc. class RedisAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'redis_app' diff --git a/redis_app/static/redis_app/style.css b/redis_app/static/redis_app/style.css index ec83e4f..afd4b84 100644 --- a/redis_app/static/redis_app/style.css +++ b/redis_app/static/redis_app/style.css @@ -1,3 +1,6 @@ +/* I don't think commenting css would be relevant enough. My comments could litteraly only describe every line, so it would be faster to just read each part */ +/* This css is not really good, I just spent 2 hours to make it because the main part is not the UX/UI. Sorry if you thinks it's ugly :( */ + body { margin: 0; font-family: Arial, sans-serif; diff --git a/redis_app/templates/courses.html b/redis_app/templates/courses.html index 263b793..133ee9c 100644 --- a/redis_app/templates/courses.html +++ b/redis_app/templates/courses.html @@ -1,38 +1,71 @@ +
{% load static %} + +No course yet
{% endif %} + +Register to a course by Searching
diff --git a/redis_app/templates/create.html b/redis_app/templates/create.html index 3c512a0..aadc816 100644 --- a/redis_app/templates/create.html +++ b/redis_app/templates/create.html @@ -22,7 +22,15 @@No course found
+No course found.
{% endif %}