diff --git "a/blog/Beginner\342\200\231s Guide to the Top 5 React Hooks.md" b/blog/2024-06-19/beginners-guide-to-the-top-5-react-hooks.md similarity index 100% rename from "blog/Beginner\342\200\231s Guide to the Top 5 React Hooks.md" rename to blog/2024-06-19/beginners-guide-to-the-top-5-react-hooks.md diff --git a/blog/automating-tasks-with-python.md b/blog/2024-07-13/automating-tasks-with-python.md similarity index 100% rename from blog/automating-tasks-with-python.md rename to blog/2024-07-13/automating-tasks-with-python.md diff --git a/blog/Dockerize Spring-boot with Github-Actions/images/image01.png b/blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image01.png similarity index 100% rename from blog/Dockerize Spring-boot with Github-Actions/images/image01.png rename to blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image01.png diff --git a/blog/Dockerize Spring-boot with Github-Actions/images/image02.png b/blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image02.png similarity index 100% rename from blog/Dockerize Spring-boot with Github-Actions/images/image02.png rename to blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image02.png diff --git a/blog/Dockerize Spring-boot with Github-Actions/images/image03.png b/blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image03.png similarity index 100% rename from blog/Dockerize Spring-boot with Github-Actions/images/image03.png rename to blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image03.png diff --git a/blog/Dockerize Spring-boot with Github-Actions/images/image04.png b/blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image04.png similarity index 100% rename from blog/Dockerize Spring-boot with Github-Actions/images/image04.png rename to blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image04.png diff --git a/blog/Dockerize Spring-boot with Github-Actions/images/image05.png b/blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image05.png similarity index 100% rename from blog/Dockerize Spring-boot with Github-Actions/images/image05.png rename to blog/2024-07-28/dockerize-spring-boot-with-github-actions/images/image05.png diff --git a/blog/Dockerize Spring-boot with Github-Actions/index.md b/blog/2024-07-28/dockerize-spring-boot-with-github-actions/index.md similarity index 100% rename from blog/Dockerize Spring-boot with Github-Actions/index.md rename to blog/2024-07-28/dockerize-spring-boot-with-github-actions/index.md diff --git a/blog/ai-in-healthcare.md b/blog/2024-07-30/ai-in-healthcare.md similarity index 100% rename from blog/ai-in-healthcare.md rename to blog/2024-07-30/ai-in-healthcare.md diff --git a/blog/containerization-with-docker-and-kubernetes.md b/blog/2024-07-30/containerization-with-docker-and-kubernetes.md similarity index 100% rename from blog/containerization-with-docker-and-kubernetes.md rename to blog/2024-07-30/containerization-with-docker-and-kubernetes.md diff --git a/blog/cloud-native-development with-microservices-and-kubernetes.md b/blog/2024-07-31/cloud-native-development with-microservices-and-kubernetes.md similarity index 100% rename from blog/cloud-native-development with-microservices-and-kubernetes.md rename to blog/2024-07-31/cloud-native-development with-microservices-and-kubernetes.md diff --git a/blog/Web-Development-with-Django.md b/blog/Web-Development-with-Django.md index de8c7d6d7..33c5b48f7 100644 --- a/blog/Web-Development-with-Django.md +++ b/blog/Web-Development-with-Django.md @@ -6,7 +6,7 @@ tags: - Web Development - Frontend Development - Backend Development -date: 2024-06-10 09:32:00 +date: 2024-06-10 --- Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. This guide will introduce you to Django, walk you through setting up a Django project, and cover key features and best practices for developing robust web applications. @@ -53,10 +53,10 @@ A Django project is a collection of settings and configurations for an instance ### Key Files and Directories -manage.py: A command-line utility for interacting with your project. -settings.py: Configuration settings for your project. -urls.py: URL declarations for your project. -wsgi.py and asgi.py: Entry points for WSGI/ASGI-compatible web servers. +- **manage.py:** A command-line utility for interacting with your project. +- **settings.py:** Configuration settings for your project. +- **urls.py:** URL declarations for your project. +- **wsgi.py and asgi.py:** Entry points for WSGI/ASGI-compatible web servers. ## 4. Building Your First Django App @@ -70,9 +70,9 @@ python manage.py startapp myapp ### Defining Models -Models are Python classes that define the structure of your database tables. Define a model in models.py: +Models are Python classes that define the structure of your database tables. Define a model in `models.py`: -```python +```python title="myapp/models.py" from django.db import models class Post(models.Model): @@ -94,7 +94,7 @@ python manage.py migrate Register your models to be managed via the Django admin interface: -```python +```python title="myapp/admin.py" from django.contrib import admin from .models import Post @@ -104,10 +104,10 @@ admin.site.register(Post) ## 5. Django Views and Templates -Creating Views -Views handle the logic of your application and return responses. Define a view in views.py: +### Creating Views +Views handle the logic of your application and return responses. Define a view in `views.py`: -```python +```python title="myapp/views.py" from django.shortcuts import render from .models import Post @@ -118,9 +118,9 @@ def index(request): ### URL Routing -Map URLs to views in urls.py: +Map URLs to views in `urls.py`: -```python +```python title="myapp/urls.py" from django.urls import path from . import views @@ -131,9 +131,9 @@ urlpatterns = [ ### Using Templates -Create HTML templates in the templates directory. For example, index.html: +Create HTML templates in the templates directory. For example, `index.html`: -```html +```html title="myapp/templates/index.html" @@ -152,9 +152,9 @@ Create HTML templates in the templates directory. For example, index.html: ### Template Inheritance -Use template inheritance to avoid redundancy. Create a base template base.html: +Use template inheritance to avoid redundancy. Create a base template `base.html`: -```html +```html title="myapp/templates/base.html" @@ -166,11 +166,12 @@ Use template inheritance to avoid redundancy. Create a base template base.html: ``` -Extend it in index.html: +Extend it in `index.html`: -```html -{% extends 'base.html' %} {% block title %}Home{% endblock %} {% block content -%} +```html title="myapp/templates/index.html" +{% extends 'base.html' %} +{% block title %}Home{% endblock %} +{% block content %}

Posts