Welcome to Web Development Using Django internship this repository consists of all the files, resources, and recorded session links which are discussed during the entire training.
- Introduction
- installations
- Initializing repositories
- Accessing Existing Repositories
- Adding to Staging area
- Committing the changes to repository
- Create a remote repository
- Adding the remotes
- Uses of Branching
- Create Branch
- Switch to new Branch and back
- Merge the new branch to Master
- How to send the branch code to new branch on remote
- Collaborate on existing projects
- Collaborate on open source projects
- Sending pull requests and handling them
- git commit
- undoing the commits
- Delete commits
- Markdown syntax
- github pages
- Python introduction
- python basics
- Operators
- Print funtion
- Practice files
- Bitwise Operators
- Strings
- Conditional Statements
- Task
- Practice files
- python Loops
- termination conditions
- notes
- Functions
- DataStructures -List
- notes
- Tuples
- Sets
- Dictionaries
- File Handling
- Tasks and Solutions
- Comprehensions
- list comprehensions
- tuple comprehensions
- dictionary comprehensions
- set comprehensions
- Iterators
- Generators
- Lambda
- Filter
- Regular Expressions ( re module )
- Introduction to Python OOP
- Declaring functions inside the classs
- Variables inside the class
- Named and name less objects
- Constructor, Destructor and
__str__
-
Inheritance
Types of inheritances: - Single inheritance : one parent and one child - Multi Level inheritance : level by level - Multiple inheritance : one child with multiple parent - Hierarchical inheritance : one parent with multiple child - Hybrid Inheritance : combines more than one inheritance
-
Polymorphism
-
Encapsulation
-
Abstraction
- Django Introduction
- Django Installation
- Project Creation
- App Creation
- Modules in Django Project and App
- Creating URLs ( static & dynamic )
- URLs and Views Linking
- Request and Response
- Django Templates
- A Dango template is simple folder whichi is used to store html file.
return render(request, '',{})
this {} are used to send a context to the html page.- the context is very similar to the python dictionary object.
- Django Templates Language
- {'data': name}
- Data Rendering from Views to Tempaltes
- Data Rendering from Templates to Views
- Static File Handling
- Models:
- Model is a blue print for how we are going to store data. each model is a python class, which is created by inheritancing the
django.db.models.Model
. - Each attribute of the model is a representation of a database field name.
- Each model class maps a single tabular data in the database.
- Model is a blue print for how we are going to store data. each model is a python class, which is created by inheritancing the
- Sync with DataBase
- python manage.py makemigration: it will create a new migration file for a new model class.
- python manage.py migrate: which is responsible for applying migrations.
- Model Creation
- Super User:
- we need to create a login details(creating a super user).
- python manage.py createsuperuser
- we need to register the model name in admin.py file, handling admin url.
in admin.py file:
from appname.moedls import model_name admin.site.register(model_name)
- Object Relational Mapping
- ORM Queries
- CRUD
- Create
- Retrieve
- Update
- Delete
- CRUD
- CRUD Operations
- Create
- Retrieve
- CRUD Operations
- Update
- Delete
-
Model Forms
- By Using this django forms we can easly manage the Html forms.
- And it will provide the data validations.
- for use this feature we need to create forms.py file in Django app.
-
Email Sending
- in setting.py we need to write the below lines
EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_HOST_USER = 'our sender email id' EMAIL_HOST_PASSWORD = 'password'
- after that we need to import a module in views.py file
from django.core.mail import EmailMessage email_msg = EmailMessage(sub, body, sender, [receiver_mail]) email_msg.send()
- To send a mail we need to turn On the less securty open of our gmail account.
created a simple django project to send a greeting card, collect name email from user. - complete it by 7th july 2021
-
Templates blocks
{% include 'htmlFileName' %}
{% extends 'htmlFileName' %} {% block NameOfTheBlock %} {% endblock %}
-
Messages in django
- Success messages
- Error messages
- Worning messages
- info messages
- Authentication
- User Profile Creation
- Greeting card task
- output git repo link
- Resourses
- install pillow for images
- PIL official documentation
- temporary file hadling
- Database connections with MySql
- settings.py
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': "<dbname>", "USER": 'root', "HOST": 'localhost', "PORT": '3306', } }
- pip install mysqlclient (python 3.6)
- You cannot download mysqlclient from pip for python 3.8. We need to download binary files(wheel) to install in python 3.8
- Wheel file link
- Open the above link and download file
- File Handling
- settings.py
- MEDIA_ROOT = os.path.join(BASE_DIR,"media") - MEDIA_URL = "/media/"
- urls.py
from django.conf import settings from django.conf.urls.static import static if settings.DEBUG: urlpatterns+=static(settings.MEDIA_URL,document_root = settings.MEDIA_ROOT)
- template
<form method="post" enctype="multipart/form-data">