Ejemplo n.º 1
0
from django.conf.urls.static import static
from .views import redirect_view
from rest_framework import routers
from accounts.views import (UsersViewSet, ProfileViewSet, PhoneViewSet,
                            AddressViewSet, CustomObtainAuthToken,
                            FacebookLogin, FacebookConnect, GoogleLogin,
                            password_reset)

router = routers.DefaultRouter()
router.register(r'users', UsersViewSet)
router.register(r'profile', ProfileViewSet)
router.register(r'phone', PhoneViewSet)
router.register(r'address', AddressViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('allauth.urls')),
    path('accounts/new-password/', password_reset),
    path('auth/facebook/', FacebookLogin.as_view(), name='fb_login'),
    path('auth/facebook/connect/',
         FacebookConnect.as_view(),
         name='fb_connect'),
    path('auth/google/', GoogleLogin.as_view(), name='google_login'),
    path('api/v1/', include(router.urls)),
    path('auth/', CustomObtainAuthToken.as_view()),
    path('api-auth/', include('rest_framework.urls')),
    path('', redirect_view),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Ejemplo n.º 2
0
    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.conf.urls.static import static
from django.urls import path, re_path, include
from django.views.generic import TemplateView
from allauth.account.views import confirm_email
from rest_auth.registration.views import RegisterView

from .routers import router
from accounts.views import FacebookLogin, GoogleLogin

urlpatterns = [
    path('admin/', admin.site.urls),
    re_path(r'^', include('django.contrib.auth.urls')),
    re_path(r'^rest-auth/', include('rest_auth.urls')),
    re_path(r'^rest-auth/registration/$',  RegisterView.as_view(),
            name='rest_register'),
    re_path(r"^rest-auth/registration/account-confirm-email/(?P<key>[\s\d\w().+-_',:&]+)/$",
            confirm_email, name="account_confirm_email"),
    re_path(r'^accounts/', include('allauth.urls')),
    re_path(r'^rest-auth/facebook/$', FacebookLogin.as_view(), name='fb_login'),
    re_path(r'^rest-auth/google/$', GoogleLogin.as_view(), name='google_login'),
    re_path(r'^api/', include(router.urls))
]+static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Ejemplo n.º 3
0
from django.contrib import admin
from django.conf.urls import url, include
from accounts.views import FacebookLogin, GoogleLogin, CurrentUser

urlpatterns = [
    url('zingo/', admin.site.urls),
    url(r'^rest-auth/', include('rest_auth.urls')),
    url(r'^rest-auth/facebook/$', FacebookLogin.as_view()),
    url(r'^rest-auth/google/$', GoogleLogin.as_view()),
    url(r'^rest-auth/current', CurrentUser.as_view()),
]
Ejemplo n.º 4
0
from django.conf.urls import url, include
from accounts.views import FacebookLogin, GoogleLogin, CurrentUser, UpdateProfileView

urlpatterns = [
    url(r'^rest-auth/', include('rest_auth.urls')),
    url(r'^facebook/$', FacebookLogin.as_view()),
    url(r'^google/$', GoogleLogin.as_view()),
    url(r'^current/$', CurrentUser.as_view()),
    url(r'^update-profile/$', UpdateProfileView.as_view()),
]