The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/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 import settings from django.conf.urls.static import static from tweets.views import TweetListView from .views import home urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', TweetListView.as_view(), name='home'), url(r'^tweet/', include('tweets.urls', namespace='tweet')), url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.contrib import admin from django.conf import settings from django.conf.urls.static import static from accounts.views import UserRegisterView from hashtags.api.views import TagTweetAPIView from hashtags.views import HashTagView from tweets.api.views import SearchTweetAPIView from tweets.views import TweetListView from .views import home, SearchView urlpatterns = [ url(r'^admin/', admin.site.urls), #admin/ url(r'^$', TweetListView.as_view(), name='home'), #/ url(r'^search/$', SearchView.as_view(), name='search'), #/ url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'), url(r'^tweet/', include('tweets.urls', namespace='tweet')), url(r'^api/tags/(?P<hashtag>.*)/$', TagTweetAPIView.as_view(), name='tag-tweet-api'), url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'), url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')), url(r'^api/', include('accounts.api.urls', namespace='profiles-api')), url(r'^register/$', UserRegisterView.as_view(), name='register'), #/ url(r'^', include('django.contrib.auth.urls')), url(r'^', include('accounts.urls', namespace='profiles')), ] if settings.DEBUG: urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
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 import settings from django.conf.urls.static import static from tweets.views import TweetListView from .views import home,aboutme from accounts.views import UserRegisterView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^about-me/',aboutme,name="about"), url(r'^$',TweetListView.as_view(),name="home"), url(r'^profiles/',include('accounts.urls',namespace="accounts")), url(r'^register/$', UserRegisterView.as_view(), name='register'), url(r'^posts/',include('tweets.urls',namespace="tweets_app")), url(r'^api/tweet',include('tweets.api.urls',namespace="tweet-api")), url(r'^', include('django.contrib.auth.urls')), ] # # if settings.DEBUG: # urlpatterns+=(static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
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 from django.views.generic.base import RedirectView from django.contrib import admin from django.conf import settings from django.conf.urls.static import static from tweets.views import (TweetCreateView, TweetDeleteView, TweetDetailView, TweetListView, TweetUpdateView) urlpatterns = [ url('^$', RedirectView.as_view(url="/")), url(r'^search/$', TweetListView.as_view(), name='list'), url(r'^create/$', TweetCreateView.as_view(), name='create'), url(r'^(?P<pk>\d+)/$', TweetDetailView.as_view(), name="detail"), url(r'^(?P<pk>\d+)/update/$', TweetUpdateView.as_view(), name='update'), url(r'^(?P<pk>\d+)/delete/$', TweetDeleteView.as_view(), name='delete'), ]
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from tweets.views import TweetListView from .views import SearchView urlpatterns = [ path('', TweetListView.as_view(), name='tweet_list'), path('admin/', admin.site.urls), path('tweets/', include('tweets.urls')), path('api/', include('tweets.api.urls')), path('accounts/', include('accounts.urls')), path('account/', include('accounts.password.urls')), path('tags/', include('hashtags.urls')), path('api/', include('accounts.api.urls')), path('/', SearchView.as_view(), name='search') ] if settings.DEBUG: urlpatterns += \ static(settings.STATIC_URL,document_root = settings.STATIC_ROOT) urlpatterns += \ static(settings.MEDIA_URL,document_root = settings.MEDIA_ROOT)
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include, re_path from django.conf import settings from django.conf.urls.static import static from tweets.views import TweetListView from .views import home urlpatterns = [ path('admin/', admin.site.urls), path('', TweetListView.as_view(),name='home'), path('tweet/', include('tweets.urls')), path('api/tweet/', include('tweets.api.urls', namespace='tweet-api')), ] if settings.DEBUG: urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
""" from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from accounts.views import UserRegisterView from hashtags.api.views import TagTweetAPIView from hashtags.views import HashTagView from tweets.api.views import SearchTweetAPIView from tweets.views import TweetListView from .views import home, SearchView urlpatterns = [ path('', TweetListView.as_view(), name="home"), path('search/', SearchView.as_view(), name="search"), path('admin/', admin.site.urls), path('api/tweet/', include('tweets.api.urls')), path('api/tags/<slug:hashtag>/', TagTweetAPIView.as_view(), name="tag-tweet-api"), path('api/search/', SearchTweetAPIView.as_view(), name="search-api"), path('api/', include('accounts.api.urls')), path('tags/<slug:hashtag>/', HashTagView.as_view(), name="hashtag"), path('tweet/', include('tweets.urls')), path('register/', UserRegisterView.as_view(), name="register"), path('', include('django.contrib.auth.urls')), path('', include('accounts.urls')), ]
from django.conf.urls import url from tweets.views import (TweetDetailView, TweetCreateView, TweetUpdateView, TweetListView, TweetDeleteView) urlpatterns = [ url(r'^$', TweetListView().as_view(), name='list'), url(r'^create/$', TweetCreateView.as_view(), name='create'), url(r'^(?P<pk>\d+)/$', TweetDetailView().as_view(), name='detail'), url(r'^(?P<pk>\d+)/update/$', TweetUpdateView().as_view(), name='update'), url(r'^(?P<pk>\d+)/delete/$', TweetDeleteView.as_view(), name='delete'), ]
from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from hashtags.views import HashTagView from hashtags.api.views import TagTweetAPIView from tweets.api.views import SearchTweetAPIView from tweets.views import TweetListView from .views import home, SearchView from accounts.views import UserRegisterView urlpatterns = [ path('admin/', admin.site.urls), path(r'', TweetListView.as_view(), name='list'), path(r'search/', SearchView.as_view(), name='search'), path(r'profiles/', include('accounts.urls', namespace='profiles')), path(r'tags/<str:hashtag>/', HashTagView.as_view(), name='hashtag'), path(r'tweets/', include('tweets.urls', namespace='tweets')), path(r'api/tweet/', include('tweets.api.urls', namespace='tweets-api')), path(r'api/', include('accounts.api.urls', namespace='profiles-api')), path(r'api/search/', SearchTweetAPIView.as_view(), name='search-api'), path(r'api/tags/<str:hashtag>/', TagTweetAPIView.as_view(), name='tag-tweet-api'), path(r'', include('django.contrib.auth.urls')), path(r'register/', UserRegisterView.as_view(), name='register'), ] if settings.DEBUG: urlpatterns += (static(settings.STATIC_URL,
from django.conf.urls.static import static from tweets.views import TweetListView from accounts.views import UserRegisterView from tweets.api.views import SearchTweetAPIView from hashtags.api.views import TagTweetAPIView from hashtags.views import HashTagView from .views import home, SearchView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^tweets/', include(('tweets.urls'), namespace='tweet')), url(r'^search/$', SearchView.as_view(), name='search'), url(r'^register/$', UserRegisterView.as_view(), name='register'), url(r'^api/tweets/', include(('tweets.api.urls'), namespace='tweet-api')), url(r'^api/search/', SearchTweetAPIView.as_view(), name='search-api'), url(r'^api/tags/(?P<hashtag>.*)/$', TagTweetAPIView.as_view(), name='tag-tweet-api'), url(r'^api/', include('accounts.api.urls', namespace='profiles-api')), url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'), url(r'^home/', TweetListView.as_view(), name='home'), url(r'^', include("django.contrib.auth.urls")), url(r'^', include('accounts.urls', namespace='profiles')), url(r'^', TweetListView.as_view(), name='home'), ] if settings.DEBUG: urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
from django.urls import path from django.views.generic import RedirectView from tweets.views import ( TweetDetailView, TweetListView, TweetCreateView, TweetUpdateView, TweetDeleteView ) app_name = 'tweet' urlpatterns = [ path('', RedirectView.as_view(url = "/")), path('search/', TweetListView.as_view(), name = 'list'), path('<int:pk>/', TweetDetailView.as_view(), name = 'detail'), path('create/', TweetCreateView.as_view(), name = 'create'), path('<int:pk>/update/', TweetUpdateView.as_view(), name = 'update'), path('<int:pk>/delete/', TweetDeleteView.as_view(), name = 'delete'), ]
""" from django.contrib import admin from django.conf.urls import url, include from django.conf import settings from django.conf.urls.static import static from accounts.views import UserRegisterView from hashtags.views import HashTagView from hashtags.api.views import TagTweetAPIView from tweets.api.views import SearchTweetAPIView from tweets.views import TweetListView from .views import home, SearchView urlpatterns = [ url(r"^admin/", admin.site.urls), url(r"^$", TweetListView.as_view(), name='home'), url(r"^search/$", SearchView.as_view(), name='search'), url(r"^tags/(?P<hashtag>.*)/$", HashTagView.as_view(), name='hashtag'), url(r"^tweet/", include('tweets.urls', namespace='tweet')), url(r"^api/tweet/", include('tweets.api.urls', namespace='tweet-api')), url(r"^api/tags/(?P<hashtag>.*)/$", TagTweetAPIView.as_view(), name='tag-tweet-api'), url(r"^api/search/$", SearchTweetAPIView.as_view(), name='search-api'), url(r"^api/", include('accounts.api.urls', namespace='profiles-api')), url(r"^register/$", UserRegisterView.as_view(), name='register'), url(r'^', include('django.contrib.auth.urls')), url(r"^", include('accounts.urls', namespace='profiles')), ] if settings.DEBUG:
from django.contrib import admin from django.conf import settings from django.contrib.staticfiles import views from django.conf.urls.static import static from acounts.views import UserRegisterView from tweets.views import TweetListView from hashtags.views import HashTagView from hashtags.api.views import TagTweetAPIView from tweets.api.views import SearchTweetAPIView from .views import home, SearchView # if i have alot of apps in my pro , i can make for every app , # its view file and its templates folder to organize the pro ##tweets here is the name of the app urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', TweetListView.as_view(), name='home'), # when press home title apear list url(r'^search/$', SearchView.as_view(), name='search'), url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'), url(r'^tweet/', include('tweets.urls', namespace='tweet')), url(r'^api/tags/(?P<hashtag>.*)/$', TagTweetAPIView.as_view(), name='tag-tweet-api'), url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'), url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')), url(r'^api/', include('acounts.api.urls', namespace='profiles-api')), url(r'^register/$', UserRegisterView.as_view(), name='register'), url(r'^', include('django.contrib.auth.urls')), url(r'^', include('acounts.urls', namespace='profiles')), ] if settings.DEBUG:
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.conf import settings from django.conf.urls.static import static from django.conf.urls import include from .views import index from tweets.views import TweetListView from hashtags.views import HashTagView urlpatterns = [ path('', TweetListView.as_view(), name="index"), path('admin/', admin.site.urls), path('tags/<path:hashtag>/', HashTagView.as_view(), name="hashtag"), # path('profiles/', include('accounts.urls', namespace='profiles')), path('tweet/', include('tweets.urls', namespace='tweets')), path('api/tweet/', include('tweets.api.urls', namespace='tweets-api')), path('api/', include('accounts.api.urls', namespace='profiles-api')), path('', include('accounts.urls', namespace='profiles')), ] if settings.DEBUG: urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))