def post(self, request): return HttpResponse('I am called from a post Request') urls.py from django.conf.urls import patterns, include, url from django.contrib import admin from tweets.views import Index admin.autodiscover() urlpatterns = patterns('', url(r'^$', Index.as_view()), url(r'^admin/', include(admin.site.urls)), )
Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Add an import: from blog import urls as blog_urls 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ # from django.conf.urls import patterns, include, url # from django.contrib import admin # from tweets import views # admin.autodiscover() # urlpatterns = patterns('', # url(r'^$', views.index, name='index'), # url(r'^admin/', include(admin.site.urls)), # ) from django.conf.urls import patterns, include, url from django.contrib import admin from tweets.views import Index admin.autodiscover() urlpatterns = patterns('', url(r'^$', Index.as_view()), url(r'^admin/', include(admin.site.urls)), )
"""django_mytweets URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from tweets.views import Index, Profile, PostTweet, Search, UserRedirect, Logout, Login urlpatterns = [ url(r'^$', Index.as_view(), name='index'), url(r'^admin/', admin.site.urls), url(r'^user/(\w+)/$', Profile.as_view()), url(r'^user/(\w+)/post/$', PostTweet.as_view()), url(r'^search/$', Search.as_view()), url(r'^login/$', Login.as_view()), url(r'^logout/$', Logout.as_view()), url(r'^profile/$', UserRedirect.as_view()), ]
"""mytweets URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.contrib import admin #from django.conf.urls import include, url from django.contrib import admin from tweets.views import Index, Profile admin.autodiscover() urlpatterns = [ url(r'^$', Index.as_view()), url(r'^user/(\w+)/$', Profile.as_view()), url(r'^admin/', admin.site.urls), ]
"""django_mytweets URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from tweets.views import Index,Profile,PostTweet,Search,UserRedirect,Logout,Login urlpatterns = [ url(r'^$',Index.as_view(),name='index'), url(r'^admin/', admin.site.urls), url(r'^user/(\w+)/$',Profile.as_view()), url(r'^user/(\w+)/post/$',PostTweet.as_view()), url(r'^search/$',Search.as_view()), url(r'^login/$',Login.as_view()), url(r'^logout/$',Logout.as_view()), url(r'^profile/$',UserRedirect.as_view()), ]