Django Creating a Project In Hindi – Django In Hindi – Aaj Ki Post Me Ham Django Ka First Project Create Karne Wale Hai |
Also Read – IPLogger Website In Django
Django Creating a Project In Hindi
Contents
Django Me Aap Kisi Bhi Tarah Ki Website Ko Create Kar Sakte Hai And Kisi Bhi Website Ko Create Karna Same Hi Code Hota Hai , To Aaj Ham Django New Project Ko Create Karne Wale Hai |
Create a Project
Django me Ham Project Ko Create Karne Ke Liye cmd prompt Ko Open Karna Hai , Chahe Aap Windows Me Ho Ya Fir Linux Me Same Hi Code Hone Wala Hai |
cmd prompt Ko Open karne Ke Bad Aapko Niche Diye Code Ko Likhne Ke Bad Enter Press Karna Hai |
$ django-admin startproject myproject
Enter Press Karne Ke Bad Ye Cmd myproject Folder Ko Create Kar Dega Or Uske Under Kuch Files Ko, Joki Niche Point Me Bataya Gaya Hai |
myproject/ manage.py myproject/ __init__.py settings.py urls.py wsgi.py
The Project Structure
myproject folder ek Tarah Ka Container Hai And Us Container Ke Under 1 File Hai manage.py and 1 folder myproject hai |
- manage.py – Aap Is File Ko ye Samanjh Lijiye Ki Command-Line Ke Through Hamare Local System Me django-admin se Interact Karne Ke Liye Istemal Ki Jati Hai And Iska Ek Example Niche Code Me Diya Gaya Hai |
Example:
$ python manage.py help
Output with cmd line:
D:\Web Development\myproject> python manage.py help Type 'manage.py help <subcommand>' for help on a specific subcommand. Available subcommands: [auth] changepassword createsuperuser [contenttypes] remove_stale_contenttypes [django] check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver [sessions] clearsessions [staticfiles] collectstatic findstatic runserver D:\Web Development\IPLoggerServer>
Aap Upper Diye Gaye Example Ko Dekh Sakte Hai , Jaise Hi Hame python manage.py help likha to usne Ye Output De Diya Hai |
Also Read – Dupolx Project In Django
Waise Aap Ise Abhi Ingore Kare |
The “myproject” subfolder − Yah Folder Actual Me python package Hai, Hamare Project Ka Jo 4 Files Contains Karta Hai Hai –
- __init__.py − Just for python, treat this folder as a package.
- settings.py − As the name indicates, Yaha Par Project Ki Setting Ki Jati Hai..
- urls.py − Yaha Par All Links Ko Defined And Call Kiya Jata Hai |
- wsgi.py − If you need to deploy your project over WSGI.
Setting Up Your Project
Hamare Project Ka subfolder myproject/settings.py. Ek Important Folder Hai , Yah Par Debug And Database And Timezone Etc.. Define Kar Sakte Hai |
DEBUG = True
Debug = True ka Matlab Ye Hota Ki Abhi Hamara Project Production Me Hai |
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'database.sql', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } }
‘Database’ dictionary Par Database Set Kar Sakte Hai, Waise Django Me Default sqlite3 Aata Hai |
Waise Agar Aapko Database Or Set Karna Hai To Aap Niche Diye Rules Ke Hisab Se Set Kar Sakte Hai |
- MySQL (django.db.backends.mysql)
- PostGreSQL (django.db.backends.postgresql_psycopg2)
- Oracle (django.db.backends.oracle) and NoSQL DB
- MongoDB (django_mongodb_engine)
New Database Ko Add Karne Se Pahle Aap Install Jarur Karke , Nhi To Aap Default Me sqlite3 Rahne De |
Ye Sab Karne Ke Bad Aap Niche Diye Cmd Line Ko Likhar Enter Press Karna Hai |
$ python manage.py runserver
Isko Run Karne Ke Bad Aap Django Ka Server Istemal Kar Sakte Hai, Django Khud Ka Server Provide Karta Hai |
Validating models... 0 errors found September 28, 2020 - 11:41:50 Django version 1.6.11, using settings 'myproject.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
Aap Dekh Sakte Hai Ki Hamara Project Run Ho Chuka Hai Aap Iska Output Niche Dekh Sakte Hai |
Output:
