From 419fbcf0372b224b9c7bb88015895870bb9802c0 Mon Sep 17 00:00:00 2001 From: Ajay-Dhangar Date: Mon, 25 Nov 2024 20:31:00 +0530 Subject: [PATCH 1/5] update few contents --- blog/Web-Development-with-Django.md | 53 ++++++++++--------- ... quantum-computing-and-its-application.md} | 8 +-- blog/sed-normalize-md-file-with-regex.md | 6 +-- blog/sql.md | 6 +-- docusaurus.config.js | 25 ++++----- 5 files changed, 51 insertions(+), 47 deletions(-) rename blog/{Quantum computing and it's application.md => quantum-computing-and-its-application.md} (97%) diff --git a/blog/Web-Development-with-Django.md b/blog/Web-Development-with-Django.md index de8c7d6d7..9b999d9af 100644 --- a/blog/Web-Development-with-Django.md +++ b/blog/Web-Development-with-Django.md @@ -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