KEMBAR78
Django Setup for Beginners | PDF | Computers
0% found this document useful (0 votes)
15 views2 pages

Django Setup for Beginners

Django

Uploaded by

Bharathi Reddy
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)
15 views2 pages

Django Setup for Beginners

Django

Uploaded by

Bharathi Reddy
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
You are on page 1/ 2

For Django Installation

In terminal

 pip install Django


 mkdir folder_name
 cd folder_name
 django-admin startproject project_name
 cd project_name
 python manage.py runserver

visual studio

first select folder that you was created in cmd. Then open new terminal and then see path of the
teminal it should be in project_name path like

“PS C:\Users\91810\seminar\pop>” (here seminar is my folder name and pop is my project_name)

If not change it to project by using cd like

 “PS C:\Users\91810\seminar> cd pop ”


 “PS C:\Users\91810\seminar\pop>”

In terminal

For creating app in project

 python manage.py startapp app_name

views.py of app

from django.http import HttpResponse

def home(request):
return Httpresponse("welcome to home page")

To link our app to main project we need to create a urls file for app

Create a new file with name “urls.py”

In app urls -write the following code

from django.urls import path


from . import views
urlpatterns = [
path('',views.home,name='home'),
]

In project urls-here I created my app name as “sam”

from django.contrib import admin


from django.urls import path,include

urlpatterns = [
path('',include('sam.urls')),
path('admin/', admin.site.urls),
]

You might also like