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 import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin # from syah import views from core.views import HomepageView urlpatterns = [ url(r'^entropy/', admin.site.urls), # url(r'^$', views.home_page, name='home'), url(r'^releases/', include('releases.urls')), url(r'^events/', include('events.urls')), url(r'^blog/', include('blog.urls')), url(r'^api/', include('core.api_urls', namespace='api')), url(r'^$', HomepageView.as_view(), name='homepage'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.USE_DEBUG_TOOLBAR: import debug_toolbar urlpatterns = [ url(r'^__debug__/', include(debug_toolbar.urls)), ] + urlpatterns
from django.conf.urls import include, url from django.contrib import admin from core.views import HomepageView from musicians.api import MusicianProfileResource urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomepageView.as_view(), name="homepage"), url(r'api/musicians/', include(MusicianProfileResource.urls())), ]
from django.conf.urls.defaults import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib.auth.decorators import login_required from core.views import HomepageView, CompareView from foursquare.views import StartAuthView, CompleteAuthView, LogoutView # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', url(r'^$', HomepageView.as_view(), name='home'), url(r'^login/', StartAuthView.as_view(), name='login'), url(r'^authenticated/', CompleteAuthView.as_view(), name='login-complete'), url(r'^logout/', LogoutView.as_view(), name='logout'), url(r'^compare/', login_required(CompareView.as_view(), login_url='/login/'), name='compare'), # Examples: # url(r'^$', 'versus.views.home', name='home'), # url(r'^versus/', include('versus.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: # url(r'^admin/', include(admin.site.urls)), )
from django.conf.urls.defaults import patterns, url from core.views import HomepageView, TalkListView, TalkDetailView, SpeakerDetailView urlpatterns = patterns( "core.views", url(r"^$", HomepageView.as_view(), name="index"), url(r"^palestras/$", TalkListView.as_view(), name="talks"), url(r"^palestra/(?P<pk>\d+)/$", TalkDetailView.as_view(), name="talk_details"), url(r"^palestrante/(?P<slug>[-\w]+)/$", SpeakerDetailView.as_view(), name="speaker"), ) """ url(r'^$', 'homepage', name='index'), url(r'^palestras/$', 'talks', name='talks'), url(r'^palestra/(\d+)/$', 'talk_details', name='talk_details'), url(r'^palestrante/([-\w]+)/$', 'speaker', name='speaker'), """
url='https://github.com/ArchiveBox/ArchiveBox/wiki'), name='Docs'), path('archive/', RedirectView.as_view(url='/')), path('archive/<path:path>', SnapshotView.as_view(), name='Snapshot'), path('admin/core/snapshot/add/', RedirectView.as_view(url='/add/')), path('add/', AddView.as_view(), name='add'), path('accounts/login/', RedirectView.as_view(url='/admin/login/')), path('accounts/logout/', RedirectView.as_view(url='/admin/logout/')), path('accounts/', include('django.contrib.auth.urls')), path('admin/', admin.site.urls), path('index.html', RedirectView.as_view(url='/')), path('index.json', static.serve, { 'document_root': settings.OUTPUT_DIR, 'path': 'index.json' }), path('', HomepageView.as_view(), name='Home'), ] urlpatterns += staticfiles_urlpatterns() if settings.DEBUG_TOOLBAR: import debug_toolbar urlpatterns += [ path('__debug__/', include(debug_toolbar.urls)), ] # # Proposed FUTURE URLs spec # path('', HomepageView) # path('/add', AddView) # path('/public', PublicIndexView) # path('/snapshot/:slug', SnapshotView)
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 core.views import HomepageView, ContactView, AboutView, MeetTheTeam, OurPartners, Partnerships, BecomeAPartner, WhoWeAre, HowItWorks from profiles.views import LoginView, RegistrationView, RegistrationComplete, ActivationComplete, profile_update from profiles.forms import PimpUserRegistrationForm urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomepageView.as_view(), name="index"), url(r'^login/', LoginView.as_view(), name="login"), url(r'^contact/', ContactView.as_view(), name="contact"), url(r'^about/', AboutView.as_view(), name="about"), url(r'^meet-the-team', MeetTheTeam.as_view(), name="team"), url(r'^who-we-are/', WhoWeAre.as_view(), name="who_we_are"), url(r'^how-it-works/', HowItWorks.as_view(), name="how_it_works"), url(r'^partnerships/', Partnerships.as_view(), name="partenrships"), url(r'^become-a-partner/', BecomeAPartner.as_view(), name="become_a_partner"), url(r'^our-partners/', OurPartners.as_view(), name="our_partners"), url(r'^accounts/register/', RegistrationView.as_view(form_class=PimpUserRegistrationForm), name='registration_register'), url(r'^accounts/registration-complete/',
""" from django.conf import settings from django.contrib import admin from django.contrib.auth.decorators import login_required from django.contrib.sitemaps.views import sitemap from django.urls import include, path, re_path from core.sitemaps import sitemaps from core.views import HomepageView from projects.views import ProjectServeDocs # https://django-allauth.readthedocs.io/en/latest/advanced.html#admin admin.site.login = login_required(admin.site.login) urlpatterns = [ path(route='', view=HomepageView.as_view(), name="homepage"), path(route='docs/<slug:slug>/<path:path>', view=ProjectServeDocs.as_view(), name="serve-docs"), path(route='accounts/', view=include('allauth.urls')), path(route='accounts/', view=include(('accounts.urls', 'accounts'), namespace='accounts')), path(route='groups/', view=include(('groups.urls', 'groups'), namespace='groups')), path(route='projects/', view=include(('projects.urls', 'projects'), namespace='projects')), path(route='search/', view=include(('search.urls', 'search'), namespace='search')), path(route='admin/', view=admin.site.urls), re_path(route=r'^api/(?P<version>v1)/', view=include(('api.urls', 'api'), namespace='api')),
"race": GenericSitemap(race_dict, priority=0.6), "blog": GenericSitemap(blog_dict, priority=0.6), } router = DefaultRouter() router.register(r"photos", PhotoViewSet) router.register(r"random_photos", RandomPhotoViewSet) admin_header = f"Lawrence Trail Hawks v{__version__}" admin.site.enable_nav_sidebar = False admin.site.site_header = admin_header admin.site.site_title = admin_header urlpatterns = [ path("", HomepageView.as_view(), name="homepage"), path("about/", AboutView.as_view(), name="about"), path("contact/", officer_list, name="contact"), path("contact/thanks/", ThanksView.as_view(), name="thanks"), path("styleguide/", StyleGuideView.as_view(), name="styleguide"), path("blog/", include("blog.urls")), path("events/", include("events.urls")), path("faq/", include("faq.urls")), path("links/", include("links.urls")), path("members/", include("members.urls")), path("news/", include("news.urls")), path("photos/", include("photos.urls")), path("races/", include("races.urls")), path("runs/", include("runs.urls")), path("sponsors/", include("sponsors.urls")), path("ajaximage/", include("ajaximage.urls")),
from django.conf.urls.defaults import patterns, url from core.views import HomepageView, TalkListView, TalkDetailView, SpeakerDetailView urlpatterns = patterns( 'core.views', url(r'^$', HomepageView.as_view(), name='index'), url(r'^palestras/$', TalkListView.as_view(), name='talks'), url(r'^palestra/(?P<pk>\d+)/$', TalkDetailView.as_view(), name='talk_details'), url(r'^palestrante/(?P<slug>[-\w]+)/$', SpeakerDetailView.as_view(), name='speaker'), ) ''' url(r'^$', 'homepage', name='index'), url(r'^palestras/$', 'talks', name='talks'), url(r'^palestra/(\d+)/$', 'talk_details', name='talk_details'), url(r'^palestrante/([-\w]+)/$', 'speaker', name='speaker'), '''
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.views.generic import TemplateView from core.views import HomepageView, DiscoveredView, ConnectView urlpatterns = [ url(r'^$', HomepageView.as_view(), name='dashboard'), url(r'discovered/$', DiscoveredView.as_view(), name='discovered'), url(r'about/$', TemplateView.as_view(template_name='about.html'), name='about'), url(r'connect/(?P<pk>\d+)/$', ConnectView.as_view(), name='connect') ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from registration.backends.hmac.views import RegistrationView from messagesApp.views import MessagesProfileView, MessagesIndexView, MessagesWidgetView import notifications.urls import postman.urls from messagesApp.views import api_send_message, api_get_conversation, api_get_correspondents urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^search/', include( 'ajaxsearch.urls' ) ), url(r'^accounts/register/$', RegistrationView.as_view(form_class=ErehwonUserSignUpForm), name="registration_register"), url(r'^accounts/activate/$', MyActivationView.as_view, name='activation'), url(r'^accounts/', include('registration.backends.hmac.urls')), # This line includes automatically all views and urls for registration/activation/password reset url(r'^accounts/login$', auth_views.login, name='login'), url(r'^$', HomepageView.as_view(), name="index"), url(r'^accounts/logout/$', logout_view, name="logout"), # {'next_page': 'homepage'}, name="logout"), url(r'^home/$', user_page, name="user_page"), url(r'^home/addproject/$', project_add, name="project_add"), url(r'^home/add-ideas/$', idea_add, name="idea_add"), url(r'^ideas/$', idea_list, name="idea_list"), url(r'^calls/$', call_list, name="call_list"), # django-postman url(r'^messages/erehwon/$', MessagesIndexView.as_view(), name='MessagesIndex View'), url(r'^messages/messageprofile/$', MessagesProfileView.as_view(), name='MessagesProfile View'), url(r'^messages/widget/$', MessagesWidgetView, name='Messages Widget View'), #TODO write some custom postman views #css classes here: http://django-postman.readthedocs.io/en/latest/views.html #and hook them up.
from django.conf.urls import patterns, include, url from django.views.generic.base import TemplateView from django.conf.urls.static import static from django.conf import settings from core.views import HomepageView from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r"^$", HomepageView.as_view()), url(r'^api/', include("activities.urls")), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^admin/', include(admin.site.urls)), ) + 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 core.views import HomepageView urlpatterns = [ path('admin/', admin.site.urls), path('contact/', include("contact.urls"), name='contact'), path('', HomepageView.as_view(), name="index"), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)