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.views.generic import TemplateView from django.contrib.auth.views import LoginView, LogoutView from menus.views import HomeView from profiles.views import ProfileFollowToggle, RegisterView, activate_user_view urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^restaurants/', include('restaurants.urls', namespace='restaurants')), url(r'^u/', include('profiles.urls', namespace='profiles')), url(r'^profile-follow/$', ProfileFollowToggle.as_view(), name='follow'), url(r'^items/', include('menus.urls', namespace='menus')), url(r'^$', HomeView.as_view(), name='home'), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^register/$', RegisterView.as_view(), name='register'), url(r'^activate/(?P<code>[a-z0-9].*)/$', activate_user_view, name='activate'), url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'), url(r'^contact/$', TemplateView.as_view(template_name='contact.html'), name='contact'), ]
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.conf import settings from django.urls import path, include from django.conf.urls.static import static from profiles.views import index, RegisterView, profile_view, ProjectList from django.contrib.auth.views import LoginView, LogoutView urlpatterns = [ path('', index, name='index'), path('admin/', admin.site.urls), path('translate/', include('translation.urls')), path('login/', LoginView.as_view(), name='login'), path('register/', RegisterView.as_view(template_name='registration/register.html'), name='register'), path('logout/', LogoutView.as_view(), name='logout'), path('profile/', profile_view, name='profile'), path('projects/', ProjectList.as_view(), name='projects') ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
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 from django.views.generic import TemplateView from django.contrib.auth.views import LoginView,LogoutView from profiles.views import ProfileFollowToggle, RegisterView,activate_user_view from menus.views import HomeView urlpatterns = [ path('restaurants/',include('restaurants.urls',namespace='restaurants')), path('items/',include('menus.urls',namespace='menus')), path('u/',include('profiles.urls',namespace='profiles')), path('profile-follow/',ProfileFollowToggle.as_view(),name='follow'), path('login/',LoginView.as_view(),name='login'), path('logout/',LogoutView.as_view(),name='logout'), path('register/',RegisterView.as_view(),name='register'), path('activate/<code>',activate_user_view,name="activate"), path('',HomeView.as_view(),name='home'), path('about/',TemplateView.as_view(template_name = "about.html"),name='about'), path('contact/',TemplateView.as_view(template_name = "contact.html"),name='contact'), path('admin/', admin.site.urls), ]
from django.urls import path from django.contrib.auth.views import LoginView from profiles.views import RegisterView app_name = 'profiles' urlpatterns = [ path('login/', LoginView.as_view(), name="login"), path('register/', RegisterView.as_view(), name="register") ]
from django.views.generic import TemplateView # from django.contrib.auth import views as auth_views # url(r'^accounts/login/$', auth_views.LoginView.as_view()), from django.contrib.auth.views import LoginView, LogoutView #PasswordResetForm url(r'^password_reset/$',PasswordResetForm, name="password_reset"), from menu.views import HomeView ### this is from profile module from profiles.views import ProfileFollowToggle, RegisterView, activate_user_view urlpatterns = [ url(r'^admin/', admin.site.urls), # url(r'^$', TemplateView.as_view(template_name="home.html"), name="home"), url(r'^$', HomeView.as_view(), name="home"), url(r'^register/$', RegisterView.as_view(), name="register"), url(r'^login/$', LoginView.as_view(), name="login"), url(r'^logout/$', LogoutView.as_view(), name="logout"), url(r'^activate/(?P<code>[a-z0-9].*)/$', activate_user_view, name="activate"), url(r'^profile-follow/$', ProfileFollowToggle.as_view(), name="follow"), url(r'^u/', include('profiles.urls', namespace="profiles")), url(r'^items/', include('menu.urls', namespace="menu")), url(r'^restaurant/', include('restaurant.urls', namespace="restaurant")), # url(r'^restaurant/$', restaurant_listview), ## url(r'^restaurant/$', RestaurantListView.as_view(), name="restaurant"), # url(r'^restaurant/create/$', restaurant_createview), # for the forms ## url(r'^restaurant/create/$', RestaurantCreateView.as_view(), name="restaurant_create"), # url(r'^restaurant/(?P<slug>\w+)/$', SearchRestaurantListView.as_view()), # url(r'^restaurant/(?P<rest_id>\w+)/$', RestaurantDetailView.as_view()),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) non_translatable_urlpatterns_DEBUG = [ # DEBUG FALSE에서 정적파일 쓰고싶으면 python manage.py runserver --insecure # 또는 아래 처럼 url(r'^static/(?P<path>.*)$', django.views.static.serve, {'document_root':settings.STATIC_ROOT}), ] translatable_urlpatterns = [ url(r'^jesses/', admin.site.urls), url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'), url(r'^$', HomeView.as_view(), name='home'), url(r'^recent/$', AllUserRecentItemListView.as_view(), name='recent'), url(r'^signup/$', RegisterView.as_view(), name='signup'), url(r'^activate/(?P<code>[a-z0-9].*)/$', activate_user_view, name='activate'), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^profile-follow/$', ProfileFollowToggle.as_view(), name='follow'), url(r'^u/', include('profiles.urls', namespace='profiles')), url(r'^items/', include('menus.urls', namespace='menus')), url(r'^restaurants/', include('restaurants.urls', namespace='restaurants')), url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'), url(r'^contact/$', TemplateView.as_view(template_name='contact.html'), name='contact'), url(r'^account/', include((account_urls, 'account'), namespace='account')), # Apps url(r'^forum/', include(board.urls)), ]
from githubapi.views import save_githubUser from profiles.views import ProfileFollowToggle, activate_user_view urlpatterns = [ url(r'^$', HomeViews.as_view(), name='home'), url(r'^about/$', AboutView.as_view(), name='about'), #instance of a class #url(r'^liquors/$', liquor_Listview), #function url(r'^liquors/', include( 'liquors.urls', namespace='liquors')), ###include the urls.py file of app Liquors url(r'^u/', include('profiles.urls', namespace='profile')), ## u = users url(r'^', include('api.urls')), # include urls of api app #url(r'^liquors/$', LiquorListView.as_view(), name ='liquors'), url(r'^login/$', LoginView.as_view(), name='login'), ## logging in url(r'^logout/$', LogoutView.as_view(), name='logout'), ## logout url(r'^register/$', RegisterView.as_view(), name='register'), ## Register user url(r'^activate/(?P<code>[a-z0-9].*)/$', activate_user_view, name='activate'), url(r'^profile-follow/$', ProfileFollowToggle.as_view(), name='follow'), ##follow url(r'^password_reset/$', password_reset, name='reset'), ##password reset url(r'^password_reset/done/$', password_reset_done, name='password_reset_done'), url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, name='password_reset_confirm'), url(r'^reset/done/$', password_reset_complete,
from django.conf import settings from django.conf.urls.defaults import * from profiles.views import ProfileEdit, ProfileView, RegisterView urlpatterns = patterns('', url(r'^$', ProfileView.as_view(), name='profile'), url(r'^edit/$', ProfileEdit.as_view(), name='profile-edit'), ) if getattr(settings, 'REGISTRATION_ENABLED', False): urlpatterns += patterns('', url(r'^register/$', RegisterView.as_view(), name='profile-register'), )
from django.conf.urls import patterns, url from profiles.views import LoginView, RegisterView, LogoutView, ProfileDetailView, PasswordChangeView, ProfileChangeView # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('profiles.views', url('^login$', LoginView.as_view(), name="login"), url('^register$', RegisterView.as_view(), name="register"), url('^logout$', LogoutView.as_view(), name="logout"), url('^profile$', ProfileDetailView.as_view(), name="profile"), url('^change-password$', PasswordChangeView.as_view(), name="password_change"), url('^update-profile$', ProfileChangeView.as_view(), name="profile_change"), )
# -*- coding: UTF-8 -*- from __future__ import unicode_literals from django.conf.urls.i18n import i18n_patterns from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView from django.contrib.auth.views import LoginView, LogoutView from menus.views import HomeView, AllUserRecentItemListView from profiles.views import ProfileFollowToggle, RegisterView, activate_user_view, check_email urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^check_email/$', check_email, name='check_email'), url(r'^registration/$', RegisterView.as_view(), name='registration'), url(r'^activate/(?P<code>[a-z0-9].*)/$', activate_user_view, name='activate'), url(r'^u/', include('profiles.urls', namespace='profiles')), url(r'^profile-follow/$', ProfileFollowToggle.as_view(), name='follow'), url(r'^$', HomeView.as_view(), name='home'), url(r'^recent/$', AllUserRecentItemListView.as_view(), name='recent'), url(r'^about/$', TemplateView.as_view(template_name='Test/about.html'), name='about'), url(r'^contacts/$', TemplateView.as_view(template_name='Test/contacts.html'), name='contacts'), url(r'^article/', include('Test.urls', namespace='article')), url(r'^items/', include('menus.urls', namespace='menus')),