To do these we need
url.py
view.py
let us take
url.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'btms.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
view.py
from django.shortcuts import render
# Create your views here.
=========================>need to change.......... in these url.py and view.py
view.py
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def hello_page(request):
return HttpResponse("hello world!")
url.py
from django.conf.urls import patterns, include, url
from login.views import hello_page
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'btms.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^$', hello_page),
)
so red color is i changed /update for url.py and view.py
when u run the page u will get like this..... ie., ...
now i got hello world message becuase of add these line ie.,
return HttpResponse("hello world!") in the view.py
now there i will write BTMS ie.,
return HttpResponse("BTMS") in the view.py
so here the work flow is like
browser=>url.py=>view.py=>httpresponse message
url.py
view.py
let us take
url.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'btms.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
view.py
from django.shortcuts import render
# Create your views here.
=========================>need to change.......... in these url.py and view.py
view.py
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def hello_page(request):
return HttpResponse("hello world!")
url.py
from django.conf.urls import patterns, include, url
from login.views import hello_page
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'btms.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^$', hello_page),
)
so red color is i changed /update for url.py and view.py
when u run the page u will get like this..... ie., ...
now i got hello world message becuase of add these line ie.,
return HttpResponse("hello world!") in the view.py
now there i will write BTMS ie.,
return HttpResponse("BTMS") in the view.py
so here the work flow is like
browser=>url.py=>view.py=>httpresponse message
No comments:
Post a Comment