"""wxProject URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/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.urls import path, re_path, include
from django.contrib import admin
from django.conf.urls.static import static
from rest_framework_simplejwt.views import TokenRefreshView, TokenObtainPairView
from usercenter.views import MyTokenObtainPairView
from utils.media import UploadMedia
from wxProject.settings import MEDIA_URL, MEDIA_ROOT


api_version = "api/v1/"

urlpatterns = [
    re_path(r'admin/', admin.site.urls),
    path(api_version + 'auth/', include('usercenter.urls', namespace='usercenter')),
    path(api_version + 'upload/', UploadMedia.as_view()),
    path(api_version + 'project/', include('project.urls', namespace="project")),
    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    re_path(r'api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    re_path(r'api/token/', MyTokenObtainPairView.as_view(), name='token_obtain_pair'),
] + static(MEDIA_URL, document_root=MEDIA_ROOT)