Django (Day 2)



Now Run Server: python manage.py runserver

If You see a Rocket It is Succuessfull 


Now press Ctrl+Click and Stop 


python manage.py makemigrations

No changes detected


python manage.py migrate

Beside all u have to see Ok 


python manage.py createsuperuser

Username (leave blank to use 'surya'): Surya1714  

Email address: Suryaanish1149198@gmail.com

Password: 

Password (again): 

Superuser created successfully.


in the link type 8000/admin & Enter


Type Username & Password and U have see Groups & Admin 

Close the Server


Update Files Django_project/urls.py


from django.contrib import admin

from django.urls import path, include

urlpatterns = [

    path('admin/', admin.site.urls),

    path('', include('test_app.urls')),

]



Update test_app/urls.py


from django.urls import path

from test_app import views


urlpatterns = [

    path('home', views.home, name='home'),

]


Update views.py


from django.http import HttpResponse

from django.shortcuts import render


# Create your views here.


def home(request):

    return HttpResponse("Hello World")


Run Server 

On Link 8000/home 

Output: Hello World 


Note: Any Doubts Contact Hemanth Sir 

Comments

Popular posts from this blog

Django (Day 1)

Django (Day 3)