"""backend URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/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 from api.views import UserView, MyTokenObtainPairView from django.conf.urls import include from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView urlpatterns = [ path('admin/', admin.site.urls), path('user/', UserView.as_view()), path('auth/', include('rest_auth.urls')), # path('token/', TokenObtainPairView.as_view()), path('token/', MyTokenObtainPairView.as_view()), path('token/refresh/', TokenRefreshView.as_view()) ]
from django.conf.urls import url, include from rest_framework.urlpatterns import format_suffix_patterns from rest_framework.authtoken.views import obtain_auth_token from rest_framework.schemas import get_schema_view from api.views import TagCreateView, TagDetailsView, UserView, UserDetailsView schema_view = get_schema_view(title = "redhawk API") urlpatterns = { url(r'^schema/$', schema_view), url(r'^taglists/$', TagCreateView.as_view(), name="tags"), url(r'^taglists/(?P<pk>[0-9]+)/$', TagDetailsView.as_view(), name="tag_detail"), url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^users/$', UserView.as_view(), name="users"), url(r'users/(?P<pk>[0-9]+)/$', UserDetailsView.as_view(), name="user_details"), url(r'^get-token/', obtain_auth_token), } urlpatterns = format_suffix_patterns(urlpatterns)
from django.contrib import admin from django.urls import path, re_path from api.views import UserView, ItemListView, ItemView, ResultListView, ResultView from m.views import RenderHtmlView from dw.views import RenderDwView from werobot.contrib.django import make_view from mx.reply import robot app_name = 'm' urlpatterns = [ path('admin/', admin.site.urls), re_path(r'^api/user/', UserView.as_view(), name='user'), re_path(r'^api/item/', ItemView.as_view(), name='item'), re_path(r'^api/itemlist/', ItemListView.as_view(), name='itemlist'), re_path(r'^api/resultlist/', ResultListView.as_view(), name='resultlist'), re_path(r'^api/result/', ResultView.as_view(), name='result'), re_path(r'^$', make_view(robot), name='robot'), re_path(r'^m/(?P<html>.+)/', RenderHtmlView.as_view(), name='m'), re_path(r'^dw/(?P<random_str>.+)/', RenderDwView.as_view(), name='dw') ]
from django.contrib import admin from django.urls import path,include from rest_framework.urlpatterns import format_suffix_patterns from rest_framework.authtoken.views import ObtainAuthToken from api.views import ( CoursesView, UserMyView, UserView, CourseUserView, LoginView, LogoutView, MessageView, ) from django.views.decorators.csrf import csrf_exempt urlpatterns = [ path('rest-auth/login/',ObtainAuthToken.as_view()), path('auth/login/',csrf_exempt(LoginView.as_view())), path('auth/logout/<str:token>/',csrf_exempt(LogoutView.as_view())), path('courses/<str:token>/',csrf_exempt(CoursesView.as_view())), path('usermy/<str:token>/',csrf_exempt(UserMyView.as_view())), path('user/<str:token>/',csrf_exempt(UserView.as_view())), path('user/<int:pk>/<str:username>/<str:token>/',csrf_exempt(CourseUserView.as_view())), path('messages/<int:pk>/<str:token>/',csrf_exempt(MessageView.as_view())), ] urlpatterns = format_suffix_patterns(urlpatterns)
terms_of_service="oaps/terms", contact=openapi.Contact(email="*****@*****.**"), license=openapi.License(name="MIT License"), ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ url(r'^swagger(?P<format>.json|.yaml)$', schema_view.without_ui(cache_timeout=None), name='schema-json'), path('swagger/', schema_view.with_ui('swagger', cache_timeout=None), name='schema-swagger-ui'), path('redoc/', schema_view.with_ui('redoc', cache_timeout=None), name='schema-redoc'), path('admin/', admin.site.urls), path('user/<int:user_id>', UserView.as_view()), path('letter/<int:letter_id>', LetterView.as_view()), path('me/', MeView.as_view()), path('faculty/<int:fac_id>', FacultyView.as_view()), path('inbox/<int:user_id>', InboxView.as_view()), path('remark/<int:remark_id>', RemarkView.as_view()), path('student/<int:std_id>', StudentView.as_view()), path(r'api-token-auth/', obtain_jwt_token), path(r'api-token-refresh/', refresh_jwt_token), path(r'api-token-verify/', verify_jwt_token), ]
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 rest_framework import routers from api import views from api.views import UserCreate, UserView, LoginView, ClassNameView, ChildParentsRelationView routerSubject = routers.DefaultRouter() routerSubject.register('', views.SubjectView) routerClassRoom = routers.DefaultRouter() routerClassRoom.register('', views.ClassRoomView) routerHoliday = routers.DefaultRouter() routerHoliday.register('', views.HolidayView) urlpatterns = [ path('admin/', admin.site.urls), path('api/users', UserCreate.as_view()), path('api/users/<int:pk>', UserView.as_view()), path('api/login', LoginView.as_view()), path('api/classes/', ClassNameView.as_view()), path('api/subjects/', include(routerSubject.urls)), path('api/classrooms/', include(routerClassRoom.urls)), path('api/childparentsrelation/', ChildParentsRelationView.as_view()), path('api/holidays/', include(routerHoliday.urls)) ]
from django.conf.urls import patterns, url from api.views import EventsView, EventView, UsersView, UserView urlpatterns = patterns('', url(r'^api/v1/events/(?P<id>\d+)', EventView.as_view()), url(r'^api/v1/events', EventsView.as_view()), url(r'^api/v1/users/(?P<id>\d+)', UserView.as_view()), url(r'^api/v1/users', UsersView.as_view()), url(r'^api/v1/', 'api.views.home'), url(r'^$', 'api.hello.views.home'), )
from django.conf.urls import url from django.urls import include, path from rest_framework import routers from api.views import ( ApiAuthorize, InventoryView, LocationDetailView, LocationView, MutationsView, NotificationView, ProductDetailView, ProductView, UserView, ) urlpatterns = [ # Inventory endpoints path("products", ProductView.as_view()), path("products/<uuid:pk>", ProductDetailView.as_view()), path("locations", LocationView.as_view()), path("locations/<uuid:pk>", LocationDetailView.as_view()), path("inventory", InventoryView.as_view()), path("mutations", MutationsView.as_view()), # User endpoints path("auth", ApiAuthorize.as_view()), path("me", UserView.as_view()), path("notifications", NotificationView.as_view()), ]
def test(request: HttpRequest): """Test endpoint for debugging purposes""" return HttpResponse("Hello, world!") urlpatterns = [ path("test/", test), # User routes # Login logout routes handled by django path("csrf", UserView.csrf), path("login", UserView.login, name="login"), path("checkLogin", UserView.checkLogin), path("logout", UserView.logout), path("users/create", UserView.create, name="register"), path("users/<int:user_id>", UserView.as_view()), # Courses routes # path("courses/create", CourseView.join), path("courses/<int:course_id>/join", CourseView.join, name="join"), path("courses/<int:course_id>/leave", CourseView.leave, name="leave"), path("courses/<int:course_id>", CourseView.as_view()), path("courses", CourseView.get_active_courses, name="courses"), # Post routes path("courses/<int:course_id>/posts/create", PostView.create, name="create_post"), path( "courses/<int:course_id>/posts/<int:post_id>", PostView.as_view(), name="view_post", ), path("courses/<int:course_id>/posts", CourseView.get_posts), # Tag routes
from django.conf.urls import url from django.contrib import admin from api.views import UsersView, UserView, UserLoginView, GuestViewSet, UserViewSet urlpatterns = [ url(r'^users/$', UsersView.as_view(), name='users'), url(r'^userOLD/$', UserView.as_view(), name='user'), url(r'^login/(?P<pk>\d+)/$', UserLoginView.as_view(), name='login'), url(r'^guests/$', GuestViewSet.as_view({ 'get': 'list', 'post': 'create' }), name='guests'), url(r'^user/$', UserViewSet.as_view({ 'get': 'list', 'post': 'create' }), name='users'), ]
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, include from django.contrib import admin from rest_framework_jwt.views import obtain_jwt_token, verify_jwt_token, refresh_jwt_token from django.views.generic import RedirectView from api.views import router, RegistrationView, GetTokenView, UserView, AllUsersView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^auth/register/', RegistrationView.as_view()), url(r'^auth/token/', GetTokenView.as_view()), url(r'^auth/refresh/', refresh_jwt_token), url(r'^auth/verify/', verify_jwt_token), url(r'^api/v1/users/me/', UserView.as_view()), url(r'^api/v1/list_all_users/', AllUsersView.as_view()), url(r'^api/v1/', include(router.urls)), url(r'^api-explorer/', include('rest_framework_swagger.urls')), url(r'^', RedirectView.as_view(url='/api-explorer/')), ]
from django.conf.urls import patterns, include, url from api.views import RegistrationView, LoginView, ProjectView, LocationView, UserView from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'clyde.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', 'api.views.home'), url(r'^admin/', include(admin.site.urls)), url(r'^users/$', RegistrationView.as_view()), url(r'^users/login/$', LoginView.as_view()), url(r'^profile/$', UserView.as_view()), url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), url(r'^projects/$', ProjectView.as_view()), url(r'^(?P<slug>\w+)/$', ProjectView.as_view()), url(r'^(?P<slug>\w+)/locations/$', LocationView.as_view()), url(r'^(?P<slug>\w+)/(?P<snail>\w+)/$', LocationView.as_view()), )
from django.conf.urls import url from api.views import UserView,DataView,login,logout urlpatterns = [ # "用户crud" url(r'user/(?P<pk>\d+)?', UserView.as_view()), # "创建/获取数据" url(r"data",DataView.as_view()), # "登录注销" url(r"login",login,name="login"), url(r"logout",logout), ]
from django.conf.urls import url, include from rest_framework.urlpatterns import format_suffix_patterns from api.views import MessageView, UserView, CustomObtainAuthToken from rest_framework.authtoken.views import obtain_auth_token urlpatterns = { url(r'^messages/$', MessageView.as_view(), name="messages"), url(r'^login/', CustomObtainAuthToken.as_view()), url(r'^register', UserView.as_view()), } urlpatterns = format_suffix_patterns(urlpatterns)
from django.conf.urls import url from api.views import LoginUser, RegisterUser, UsersView, UserView urlpatterns = [ url(r'^users/$', UsersView.as_view(), name='api-users'), url(r'^users/me/$', UserView.as_view(), name='api-me'), url(r'^register/$', RegisterUser.as_view(), name='api-register'), url(r'^login/$', LoginUser.as_view(), name='api-login'), ]
def get(self, request): generator = SchemaGenerator() schema = generator.get_schema(request=request) return Response(schema) urlpatterns = [ # Swagger documentation # url(r'^$', SwaggerSchemaView.as_view()), #url(r"^accept-terms$", AcceptTermsView.as_view()), path("case/<int:pk>/", CaseView.as_view()), path("journey/", JourneyMapView.as_view()), path("case/", CaseView.as_view()), path("form-print/<int:case_id>/", FormToPdfView.as_view()), path("user-info/", UserView.as_view()), #path("efiling/document-types/", EFilingDocumentTypesView.as_view()), #path("efiling/locations/", EFilingLocationView.as_view()), path("efiling/<int:case_id>/submit/", EFilingSubmitView.as_view()), ] if settings.OIDC_ENABLED: urlpatterns.append(path("oidc/", include("oidc_rp.urls"))) """ Usually in our Docker/Production environment the API server and the WEB server are both on port 8080. If they are on the same port the "?next=" querystring for login redirect will work correctly, otherwise OIDC_RP_AUTHENTICATION_REDIRECT_URI needs to be set. EX. OIDC_RP_AUTHENTICATION_REDIRECT_URI = http://localhost:8080/choose-how-to-attend-your-traffic-hearing/admin """ LOGGER = logging.getLogger(__name__)
from django.conf.urls import patterns, url from api.views import UserView,UserEmail,ArticleList urlpatterns = patterns( 'api.views', url(r'^users/$', 'user_list', name='user_list'), url(r'^users/email/(?P<email>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})$', 'user_detail_by_email', name='user_detail_by_email'), url(r'^users/detail/email/(?P<email>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})$', 'user_full_detail_by_email', name='user_full_detail_by_email'), url(r'^users/(?P<pk>[0-9]+)$', 'user_detail', name='user_detail'), url(r'^users/preferences/(?P<id>[0-9]+)$', 'user_preferences', name='user_preferences'), url(r'^users/photos/user/(?P<id>[0-9]+)$', 'user_photos', name='user_photos'), url(r'^users/chats/user/(?P<id>[0-9]+)$', 'user_chats', name='user_chats'), url(r'^users/properties/user/(?P<userid>[0-9]+)$', 'user_properties', name='user_properties'), url(r'^users/relations/user/(?P<id>[0-9]+)$', 'user_relations', name='user_relations'), url(r'^users/events/user/(?P<id>[0-9]+)$', 'user_events', name='user_events'), url(r'^users/notifications/user/(?P<id>[0-9]+)$', 'user_notifications', name='user_notifications'), url(r'^users/devices/user/(?P<id>[0-9]+)$', 'user_devices', name='user_devices'), url(r'^users/events/$', 'events', name='events'), url(r'^events/(?P<id>[0-9]+)$', 'events_by_id', name='events_by_id'), url(r'^events/event/(?P<id>[0-9]+)$', 'users_by_event_id', name='users_by_event_id'), url(r'^user/(?P<id>[0-9]+)$', UserView.as_view(), name='user-view'), url(r'^user/email/(?P<email>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})$', UserEmail.as_view(), name='user-email'), url(r'^photos/$', ArticleList.as_view(),name='article-list'), )