diff --git a/django-diary/README.md b/django-diary/README.md index e0c0fc2080..ad3dd35464 100644 --- a/django-diary/README.md +++ b/django-diary/README.md @@ -1,13 +1,8 @@ -# Django Diary - -> **Note:** The project is built with `Python 3.9.1`, but should work with any Python3 version. - -## About this repository +# Build Your Personal Diary With Django This is a companion project to the ["Build Your Personal Diary With Django"](https://realpython.com/django-diary-project-python/) tutorial on Real Python. Visit the article to follow along or download the content of `source_code_final` folder from this repository. -## How To Run `django-diary` Type the following commands into a terminal to create and activate a virtual environment and install the requirements: @@ -16,8 +11,7 @@ $ python -m venv venv $ source venv/bin/activate $ python -m pip install -r requirements.txt ``` - -Then run the database migrations and create a superuser: +Then you can navigate into a step folder, run the database migrations, and create a superuser: ```sh $ python manage.py migrate @@ -30,6 +24,3 @@ Finally, run the local Django development server: $ python manage.py runserver ``` -## License - -Distributed under the MIT license. diff --git a/django-diary/requirements.txt b/django-diary/requirements.txt new file mode 100644 index 0000000000..28e8c66750 --- /dev/null +++ b/django-diary/requirements.txt @@ -0,0 +1,3 @@ +asgiref==3.8.1 +Django==5.1.4 +sqlparse==0.5.3 diff --git a/django-diary/source_code_final/diary/asgi.py b/django-diary/source_code_final/diary/asgi.py index d24c6f1cdf..5fac3d04e9 100644 --- a/django-diary/source_code_final/diary/asgi.py +++ b/django-diary/source_code_final/diary/asgi.py @@ -4,7 +4,7 @@ It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see -https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ +https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ """ import os diff --git a/django-diary/source_code_final/diary/settings.py b/django-diary/source_code_final/diary/settings.py index 3b3d14bcba..89d48bf206 100644 --- a/django-diary/source_code_final/diary/settings.py +++ b/django-diary/source_code_final/diary/settings.py @@ -1,13 +1,13 @@ """ Django settings for diary project. -Generated by 'django-admin startproject' using Django 3.2.1. +Generated by 'django-admin startproject' using Django 5.1.4. For more information on this file, see -https://docs.djangoproject.com/en/3.2/topics/settings/ +https://docs.djangoproject.com/en/5.1/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/3.2/ref/settings/ +https://docs.djangoproject.com/en/5.1/ref/settings/ """ from pathlib import Path @@ -17,11 +17,11 @@ # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = ( - "django-insecure-kom*7k3n4v3gj_mrcp19r_(rl#v^t2v90i_t2dd9&4*4e1nb%+" + "django-insecure-lxfw6(cjvk39um)u-pot#ri79*14rg_c#1nharb)&l10%5jymv" ) # SECURITY WARNING: don't run with debug turned on in production! @@ -74,7 +74,7 @@ # Database -# https://docs.djangoproject.com/en/3.2/ref/settings/#databases +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases DATABASES = { "default": { @@ -85,7 +85,7 @@ # Password validation -# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -104,7 +104,7 @@ # Internationalization -# https://docs.djangoproject.com/en/3.2/topics/i18n/ +# https://docs.djangoproject.com/en/5.1/topics/i18n/ LANGUAGE_CODE = "en-us" @@ -112,17 +112,15 @@ USE_I18N = True -USE_L10N = True - USE_TZ = True # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/3.2/howto/static-files/ +# https://docs.djangoproject.com/en/5.1/howto/static-files/ -STATIC_URL = "/static/" +STATIC_URL = "static/" # Default primary key field type -# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" diff --git a/django-diary/source_code_final/diary/wsgi.py b/django-diary/source_code_final/diary/wsgi.py index 6951b16c85..50dd87ea70 100644 --- a/django-diary/source_code_final/diary/wsgi.py +++ b/django-diary/source_code_final/diary/wsgi.py @@ -4,7 +4,7 @@ It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see -https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ +https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/ """ import os diff --git a/django-diary/source_code_final/entries/migrations/0001_initial.py b/django-diary/source_code_final/entries/migrations/0001_initial.py index 57ea37dfc2..f792651a73 100644 --- a/django-diary/source_code_final/entries/migrations/0001_initial.py +++ b/django-diary/source_code_final/entries/migrations/0001_initial.py @@ -1,24 +1,36 @@ -# Generated by Django 3.2.1 on 2021-05-09 17:12 +# Generated by Django 5.1.4 on 2025-01-06 17:01 -from django.db import migrations, models import django.utils.timezone +from django.db import migrations, models class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Entry', + name="Entry", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=200)), - ('content', models.TextField()), - ('date_created', models.DateTimeField(default=django.utils.timezone.now)), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=200)), + ("content", models.TextField()), + ( + "date_created", + models.DateTimeField(default=django.utils.timezone.now), + ), ], + options={ + "verbose_name_plural": "Entries", + }, ), ] diff --git a/django-diary/source_code_final/entries/static/css/diary.css b/django-diary/source_code_final/entries/static/css/diary.css index a6925aeb92..aa2090daa0 100644 --- a/django-diary/source_code_final/entries/static/css/diary.css +++ b/django-diary/source_code_final/entries/static/css/diary.css @@ -31,7 +31,6 @@ h2, h3 { } h2 { - /* background-color: lightpink; */ background-color: aquamarine; } diff --git a/django-diary/source_code_final/entries/templates/entries/base.html b/django-diary/source_code_final/entries/templates/entries/base.html index 7ae979a73f..11cded607a 100644 --- a/django-diary/source_code_final/entries/templates/entries/base.html +++ b/django-diary/source_code_final/entries/templates/entries/base.html @@ -1,30 +1,26 @@ {% load static %} - -
- -