0% found this document useful (0 votes)
46 views1 page

Django Short Notes

Django is a high-level Python web framework that promotes rapid development through its MVT architecture, admin interface, and ORM capabilities. To create a project, use 'django-admin startproject' and to create an app, use 'python manage.py startapp', ensuring to register the app in settings.py. Models in Django define the database schema, and migrations are handled with 'makemigrations' and 'migrate' commands.

Uploaded by

tejaspanthri8thc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views1 page

Django Short Notes

Django is a high-level Python web framework that promotes rapid development through its MVT architecture, admin interface, and ORM capabilities. To create a project, use 'django-admin startproject' and to create an app, use 'python manage.py startapp', ensuring to register the app in settings.py. Models in Django define the database schema, and migrations are handled with 'makemigrations' and 'migrate' commands.

Uploaded by

tejaspanthri8thc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Django Short Notes

1. Introduction to Django

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design.
Key features:
- MVT architecture (Model-View-Template)
- Admin interface
- ORM (Object-Relational Mapping)
- Security features (CSRF, XSS protection)
- Scalability and reusability

2. Creating a Django Project

To start a project:
$ django-admin startproject projectname

Project structure:
- [Link]: Command-line utility
- projectname/: Main project folder with [Link], [Link], [Link], [Link]

To run server:
$ python [Link] runserver

3. Creating a Django App

Apps are modular components of a Django project.

Create an app:
$ python [Link] startapp appname

Register it in [Link] -> INSTALLED_APPS

Basic files in an app:


- [Link]: Define database models
- [Link]: Define views (controller logic)
- [Link]: Define routing (if added)
- [Link]: Admin interface configuration

4. Models and ORM

Django uses models to define database schema in Python.

Example:
class Post([Link]):
title = [Link](max_length=100)
content = [Link]()

Migrations:
$ python [Link] makemigrations
$ python [Link] migrate

You might also like