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 fcuser.views import index, RegisterView, LoginView from product.views import ProductList, ProductCreate, ProductDetail from order.views import OrderCreate urlpatterns = [ path('admin/', admin.site.urls), path('', index), path('login/', LoginView.as_view()), path('register/', RegisterView.as_view()), # 클래스는 as_view() 함수 이용해야함 path('product/', ProductList.as_view()), path('product/<int:pk>/', ProductDetail.as_view()), # int 형일 때 pk라는 변수에 저장됨 path('product/create/', ProductCreate.as_view()), path('order/create/', OrderCreate.as_view()), ]
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 baton.autodiscover import admin from django.urls import path, include from fcuser.views import index, logout, RegisterView, LoginView from product.views import ProductList, ProductCreate, ProductDetail, ProductListAPI, ProductDetailAPI from order.views import OrderCreate, OrderList urlpatterns = [ path('admin/', admin.site.urls), path('baton/', include('baton.urls')), path('', index), # class의 경우 as_view()를 붙여야 함 path('register/', RegisterView.as_view()), path('login/', LoginView.as_view()), path('product/', ProductList.as_view()), path('product/create/', ProductCreate.as_view()), # int형 pk로 파라미터를 받아서 해당 pk를 가진 상품을 상세보기함 path('product/<int:pk>/', ProductDetail.as_view()), path('order/', OrderList.as_view()), path('order/create/', OrderCreate.as_view()), path('logout/', logout), path('api/product/', ProductListAPI.as_view()), path('api/product/<int:pk>/', ProductDetailAPI.as_view()) ]
"""fc_django URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/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 fcuser.views import index, RegisterView, LoginView urlpatterns = [ path("admin/", admin.site.urls), path("", index), path("register/", RegisterView.as_view()), path("login/", LoginView.as_view()), ]
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 fcuser.views import index, RegisterView, LoginView from product.views import ProductList, ProductCreate, ProductDetail from order.views import OrderCreate, OrderList urlpatterns = [ path("admin/", admin.site.urls), path("", index), path("register/", RegisterView.as_view()), # 뷰클래스 사용시 as_view() 함수를 사용해야합니다 path("login/", LoginView.as_view()), path("product/", ProductList.as_view()), path("product/<int:pk>/", ProductDetail.as_view()), # path("product/create", ProductCreate.as_view()) 로 입력해서 계속 에러가 났엇음 슬래시 주의할것 path("product/create/", ProductCreate.as_view()), path("order/", OrderList.as_view()), path("order/create/", OrderCreate.as_view()), ]
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.urls import include from fcuser.views import index, RegisterView, LoginView, logout from product.views import ProductList, ProductCreate, ProductDetail from order.views import OrderCreate, OrderList # OrderFail from imageUp.views import PostView from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('', index), path('summernote/', include('django_summernote.urls')), path('register/', RegisterView.as_view()), # class를 사용하여 뷰를 만든 경우 as_view 메소드를 사용해야한다. path('login/', LoginView.as_view()), path('logout/', logout), path('product/', ProductList.as_view()), path('product/<int:pk>/', ProductDetail.as_view()), path('product/create/', ProductCreate.as_view()), path('order/', OrderList.as_view()), path('order/create/', OrderCreate.as_view()), # path('order/fail/', OrderFail.as_view()), path('imageUp/', PostView.as_view()), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""fc_django 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.contrib import admin from django.urls import path from fcuser.views import index, RegisterView, LoginView from product.views import ProductList, ProductCreate urlpatterns = [ path('admin/', admin.site.urls), path('', index), path('register/', RegisterView.as_view()), # 클래스는 as_view()라는 함수를 작성해줘야함 path('login/', LoginView.as_view()), path('product/', ProductList.as_view()), path('product/create/', ProductCreate.as_view()), ]
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 fcuser.views import index, logout, RegisterView, LoginView from product.views import (ProductList, ProductCreate, ProductDetail, ProductListAPI, ProductDetailAPI) from order.views import OrderCreate, OrderList urlpatterns = [ path('admin/', admin.site.urls), path('', index), path('register/', RegisterView.as_view()), # 클래스는 as_view() 함수 활용하여 호출 path('login/', LoginView.as_view()), path('logout/', logout), path('product/', ProductList.as_view()), path('product/create/', ProductCreate.as_view()), path('product/<int:pk>/', ProductDetail.as_view()), path('order/create/', OrderCreate.as_view()), path('order/', OrderList.as_view()), path('api/product/', ProductListAPI.as_view()), path('api/product/<int:pk>/', ProductDetailAPI.as_view()), ]
from django.contrib import admin from django.urls import path from fcuser.views import index, logout, RegisterView, LoginView from product.views import (ProductList, ProductListAPI, ProductCreate, ProductDetail, ProductDetailAPI) from order.views import OrderCreate, OrderList urlpatterns = [ path('admin/', admin.site.urls), path("", index), path("register/", RegisterView.as_view()), # 클래스일 경우 뒤에 as_view()를 붙이기 path("login/", LoginView.as_view()), path("logout/", logout), path("product/", ProductList.as_view()), path("product/create/", ProductCreate.as_view()), path("product/<int:pk>/", ProductDetail.as_view()), path("order/", OrderList.as_view()), path("order/create", OrderCreate.as_view()), path("api/product/", ProductListAPI.as_view()), path("api/product/<int:pk>/", ProductDetailAPI.as_view()) ]
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from fcuser.views import index, logout, RegisterView, LoginView from product.views import ( ProductList, ProductCreate, ProductDetail, ProductListAPI, ProductDetailAPI ) from order.views import OrderList, cart, OrderDetail, orderCreate urlpatterns = [ path('admin/', admin.site.urls), path('', index), path('login/', LoginView.as_view()), path('register/', RegisterView.as_view()), #class 는 .as_view() 함수 써줘야됨 path('logout/', logout), path('product/', ProductList.as_view()), path('product/<int:pk>/', ProductDetail.as_view()), path('product/create/', ProductCreate.as_view()), # path('order/', OrderList.as_view()), path('order/', OrderList), # path('order/<int:pk>/', OrderDetail.as_view()), path('order/<int:pk>/', OrderDetail), path('order/create/', orderCreate), path('cart/', cart), # path('order/create/', OrderCreate.as_view()), path('api/product/', ProductListAPI.as_view()), path('api/product/<int:pk>/', ProductDetailAPI.as_view()), ]