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.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path from django.views.generic import TemplateView from apps.newsletters.views import NewsLetterView from common.views import LoginView, logout_view urlpatterns = [ path("admin/", admin.site.urls), path("success/", TemplateView.as_view(template_name="success_url.html", ), name="success"), path("newsletter/", NewsLetterView.as_view(), name="newsletter"), path("login/", LoginView.as_view(), name="login"), path("logout/", logout_view, name="logout"), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.urls import path, re_path from common.views import ( HomeView, LoginView, ForgotPasswordView, LogoutView, ChangePasswordView, ProfileView, UsersListView, CreateUserView, UpdateUserView, UserDetailView, UserDeleteView, PasswordResetView, DocumentListView, DocumentCreateView, UpdateDocumentView, DocumentDetailView, DocumentDeleteView, download_document) from django.conf.urls.static import static from django.conf import settings app_name = 'common' urlpatterns = [ path('', HomeView.as_view(), name='home'), path('login/', LoginView.as_view(), name='login'), path('forgot-password/', ForgotPasswordView.as_view(), name='forgot_password'), path('logout/', LogoutView.as_view(), name='logout'), path('change-password/', ChangePasswordView.as_view(), name='change_password'), path('profile/', ProfileView.as_view(), name='profile'), # User views path('users/list/', UsersListView.as_view(), name='users_list'), path('users/create/', CreateUserView.as_view(), name='create_user'), path('users/<int:pk>/edit/', UpdateUserView.as_view(), name="edit_user"), path('users/<int:pk>/view/', UserDetailView.as_view(), name='view_user'), path('users/<int:pk>/delete/', UserDeleteView.as_view(), name='remove_user'), path( 'password-reset/', PasswordResetView.as_view(), name='password_reset'), path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
name="homepage", ), path("admin/", admin.site.urls), path( "success/", TemplateView.as_view(template_name="success.html", ), name="success", ), path( "newsletter/", NewsLetterView.as_view(), name="newsletter", ), path( "login/", LoginView.as_view(), name="login", ), path( "logout/", logout_view, name="logout", ), path("cars/", include( "apps.cars.urls", namespace="cars_v1", )), path("dealers/", include( "apps.dealers.urls", namespace="dealers_v1", )),
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 common.views import DashboardView, ChangePasswordView from common.views import LoginView urlpatterns = [ url(r'^$', DashboardView.as_view(), name='dashboard'), url(r'^login/$', LoginView.as_view(), name='login_page'), url(r'^change-password/$', ChangePasswordView.as_view(), name='change_password'), url(r'^inventory/', include('inventory.urls', namespace='inventory')), url(r'^admin/', admin.site.urls), # third party app urls url(r'^accounts/', include('allauth.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. 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 common.views import LoginView from django.conf.urls import handler403 from common.views import permission_denied from rest_framework_jwt.views import obtain_jwt_token handler403 = permission_denied urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^common/',include('common.urls')), url(r'^cmdb/',include('cmdb.urls')), url(r'^api/v1/api-auth$',obtain_jwt_token), url(r'^api/v1/cmdb/',include('cmdbapi.urls')), url(r'^accounts/login/$',LoginView.as_view(),name='login'), url(r'^account/',include('account.urls')), url(r'^application/',include('application.urls')), url(r'^job/',include('job.urls')), url(r'^database/',include('database.urls')), url(r'^consul_manage/',include('consul_manage.urls')), url(r'^deployment/',include('deployment.urls')) ]
class BillConfig: platform = 'bill' db_name = 'rural_bill' user_col = 'user' signer = TimedJSONWebSignatureSerializer( 'IVxZQ8t6vM9NmbHw7xbtEvCYDWYpW3xR1Aw/1l3LeX7gCGS/2zMa6qXIZC273Q==', expires_in=60 * 15) init_admin = { '_id': get_uuid(), 'username': '******', 'password': generate_password_hash('admin'), 'type': 'super' } MONGODB.get_db(BillConfig.user_col, BillConfig.db_name).update_one({'username': '******'}, {'$setOnInsert': init_admin}, upsert=True) bp = Blueprint('bill', __name__) bp.add_url_rule('/auth/login', view_func=LoginView.as_view('login', BillConfig.user_col, signer, BillConfig.platform, db_name=BillConfig.db_name))
from django.conf import settings from common import views from common.views import LoginView from common.views import hostTotalCount handler400 = "common.views.page_not_found" handler500 = "common.views.page_error" handler403 = "common.views.page_forbidden" urlpatterns = [ url(r'^static/(?P<path>.*)$', static.serve, {'document_root': settings.STATIC_ROOT}, name='static'), url(r'^admin/', admin.site.urls), url(r'^$', LoginView.as_view(), name='index'), url(r'^checkLogin/$', views.checkLogin, name='checkLogin'), url(r'^logout/$', views.logout, name='logout'), url(r'^mainform/$', views.mainform, name='mainform'), url(r'^dashboard/$', views.dashboard, name='mainform'), url(r'^cmdb/', include('devops_cmdb.urls', namespace='cmdb')), url(r'^platform/', include('common_platform.urls', namespace='platform')), url(r'^deploy/', include('devops_deploy.urls', namespace='deploy')), url(r'^jira/', include('devops_jira.urls', namespace='jira')), url(r'^working/', include('devops_tools.urls', namespace='working')), url(r'^presrb/', include('devops_pre_srb.urls', namespace='presrb')), url(r'^application/', include('devops_application_manage.urls', namespace='application')), url(r'^flow/', include('devops_flow.urls', namespace='flow')), url(r'^host_total_count/', hostTotalCount, name='host_total_count'), url(r'^auth/', include('devops_auth.urls', namespace='auth')),