Welcome to my First Django App
I am creating this app by refering https://docs.djangoproject.com/en/2.2/intro/tutorial01/
Prerequisites
- Install Python ( https://www.python.org/downloads/ )
- Install Django (
pip install django
) make sure you run powershell/cmd in administrator mode.
Getting Started
👉 To Create Project
django-admin startproject mysite
👉 To Create Polls App
python manage.py startapp polls
##W
- Update The View
go to file polls\views.py
from django.shortcuts import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
- Create Polls URL
polls\url.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
- Update Root URL
mysite\urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]