0% found this document useful (0 votes)
9 views3 pages

Django Commands

The document provides a guide on using Django commands for setting up a virtual environment, starting a new project, and creating applications. It includes commands for activating the environment, installing Django, running the server, and performing basic ORM operations such as creating and retrieving objects. Additionally, it outlines the structure for defining URL paths for views in a Django application.

Uploaded by

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

Django Commands

The document provides a guide on using Django commands for setting up a virtual environment, starting a new project, and creating applications. It includes commands for activating the environment, installing Django, running the server, and performing basic ORM operations such as creating and retrieving objects. Additionally, it outlines the structure for defining URL paths for views in a Django application.

Uploaded by

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

DJANGO COMMANDS

--to create env


-python –version
-python -m venv myenv
-python -m venv sysenv

-sysenv\Scripts\activate
-pip install Django
-python -m django --version

-to start a new project


-django-admin startproject my_firstproject

-to go inside the folder


-cd my_firstproject
python [Link] runserver # to run project

-to get out of folder


-cd ../
CTRL + C TO break the server

-To create one more folder in code


-python [Link] startapp myapp

from [Link] import home,about,contact,service


path('admin/', [Link]),
path('home',home),
path('about',about),
path('contact',contact),
path('service',service)

ORM
----Create object in orm
[Link](field_name=123)
ob=Model(field_name=123)
[Link]()

---read operation:
[Link]() (All records are store)
[Link](pk_name=131) (single object return)
rec=[Link](pk_name=131) (single object return) {{rec.field_name}}
[Link](pk_name) ##[(), () , ()]
[Link](pk_name) ##[(), () , ()]

You might also like