コード例 #1
0
ファイル: urls.py プロジェクト: irden-fire/irden_fire_server
from django.conf.urls import include, patterns, url
from authentication.views import UserListAPIView
from authentication.views import CurrentUserView
from authentication.views import CreateUserView
from authentication.views import CreateUserDataView
from authentication.views import UpdateUserDataView

urlpatterns = [
    url(r'api/v1/auth/login/', 'rest_framework_jwt.views.obtain_jwt_token'),
    url(r'api/v1/current_user/', CurrentUserView.as_view()),
    url(r'api/v1/create_user/', CreateUserView.as_view()),
    url(r'create_user_data/', CreateUserDataView.as_view()),
    url(r'^update_user_data/(?P<pk>[0-9]\d+)/$', UpdateUserDataView.as_view()),
]
コード例 #2
0
ファイル: urls.py プロジェクト: josemar7/thomas
from rest_framework_nested import routers

from authentication.views import AccountViewSet, LoginView, LogoutView, CurrentUserView, CheckView
from tests.views import TestWordsViewSet
from thomas.views import IndexView
from words.views import WordViewSet, AccountWordsViewSet, WordTypeViewSet, ParameterViewSet

router = routers.SimpleRouter()

router.register(r'accounts', AccountViewSet)
router.register(r'words', WordViewSet)
router.register(r'wordsType', WordTypeViewSet)
router.register(r'parameter', ParameterViewSet)
router.register(r'tests', TestWordsViewSet)

accounts_router = routers.NestedSimpleRouter(
    router, r'accounts', lookup='account'
)
accounts_router.register(r'words', AccountWordsViewSet)

urlpatterns = [
    url(r'^api/v1/auth/login/$', LoginView.as_view(), name='login'),
    url(r'^api/v1/auth/check/$', CheckView.as_view(), name='check'),
    url(r'^api/v1/auth/logout/$', LogoutView.as_view(), name='logout'),
    url(r'^api/v1/auth/current/$', CurrentUserView.as_view(), name='current'),
    url(r'^api/v1/', include(router.urls)),
    url(r'^api/v1/', include(accounts_router.urls)),
    url('^.*$', IndexView.as_view(), name='index'),

]
コード例 #3
0
ファイル: urls.py プロジェクト: HideMode/ShanBay
router = routers.SimpleRouter()
router.register(r'accounts', AccountViewSet)
router.register(r'words', WordViewSet)
router.register(r'notes', NoteViewSet)

urlpatterns = [

    url(r'^api/v1/', include(router.urls)),
    url(r'^api/v1/auth/login/$', LoginView.as_view(), name='login'),
    url(r'^api/v1/auth/logout/$', LogoutView.as_view(), name='logout'),
    url(r'^api/v1/user/words/$', UserWordAPI.as_view(), name='user_word_api'),
    url(r'^api/v1/options/$', WordOptionsViewSet.as_view(), name='WordOptions'),
    url(r'^api/v1/examples/$', ExampleViewSet.as_view(), name='ExampleView'),
    # grappelli urls
    url(r'^grappelli/', include('grappelli.urls')), 
    # file-browser urls
    url(r'^admin/filebrowser/', include(site.urls)),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', IndexView.as_view(), name='index'),

]

urlpatterns += [
    url(r'^account/currentuser/$', CurrentUserView.as_view(), name="CurrentUser"),
    url(r'^account/uploadimage/$', UserUploadImageView.as_view(), name="UploadImage"),
    url(r'^account/checkpassword/$', CheckUserPasswordView.as_view(), name="CheckPassword")
]

urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
コード例 #4
0
ファイル: urls.py プロジェクト: LazerCube/ceres_api
account_router = routers.NestedSimpleRouter(router, r'accounts', lookup='account')
account_router.register(r'relationships',  NestedRelationshipViewSet, base_name='account-relationships')
account_router.register(r'friends', NestedFriendViewSet, base_name='account-friends')
account_router.register(r'activity', NestedActivityViewSet, base_name='account-activity')

'''
Include oauth2_provider urls one by one because "/applications" urls are not secure.
See this issue :  https://github.com/evonove/django-oauth-toolkit/issues/196
Waitting for fix in the meantime
'''
print(os.environ.get('DJANGO_SETTINGS_MODULE'))

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^', include(room_router.urls)),
    url(r'^', include(account_router.urls)),
    url(r'^auth/$', views.AuthorizationView.as_view(), name="authorize"),
    url(r'^auth/token/$', views.TokenView.as_view(), name="token"),
    url(r'^auth/revoke_token/$', views.RevokeTokenView.as_view(), name="revoke-token"),
    url(r'^me/', CurrentUserView.as_view(), name="whoami"),
    url(r'^auth/', include('rest_framework.urls', namespace='rest_framework'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# Warning : the following lines are unsecure
if settings.DEBUG:
    # Application management views
    urlpatterns += [
        url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
    ]