[Project combat] Python based on the Django framework to implement a campus online one-stop shopping system

Hits: 0

Description: This is a web actual project (with software + code + documentation + video explanation ), if you need software + code + documentation + video explanation , you can get it directly at the end of the article.

Video show:

[Project combat] Python based on the [Django] framework to implement a campus online one-stop shopping system

System function :

Key code :

from django.views.static import serve from rest_framework.documentation import include_docs_urls</p> <p>import xadmin from django.contrib import admin from django.urls import path, re_path, include from django.views.generic import TemplateView from VueDjangoFrameWorkShop.settings import MEDIA_ROOT from goods.views import GoodsListViewSet, CategoryViewset, BannerViewset, IndexCategoryViewset, HotSearchsViewset from trade.views import ShoppingCartViewset, OrderViewset, AlipayView from user_operation.views import UserFavViewset, LeavingMessageViewset, AddressViewset from users.views import SmsCodeViewset, UserViewset</p> <h1>from goods.views import GoodsListView,</h1> <h1>from goods.views_base import GoodsListView</h1> <p>from rest_framework.routers import DefaultRouter from rest_framework.authtoken import views from rest_framework_jwt.views import obtain_jwt_token</p> <h1>goods_list = GoodsListViewSet.as_view({</h1> <h1>'get': 'list',</h1> <h1>})</h1> <p>router = DefaultRouter()</p> <h1>Configure the url of goods, what is the basename for</h1> <p>router.register( r'goods' , GoodsListViewSet, base )</p> <p>router.register(r'categorys', CategoryViewset, base)</p> <h1>Configure the url of codes</h1> <p>router.register( r'code' , SmsCodeViewset, base )</p> <p>router.register(r'users', UserViewset, base)</p> <h1>Configure user favorite url</h1> <p>router.register( r'userfavs' , UserFavViewset, base )</p> <h1>Configure the url of user messages</h1> <p>router.register( r'messages' , LeavingMessageViewset, base )</p> <h1>Shipping address</h1> <p>router.register( r'address' , AddressViewset, base )</p> <h1>Shopping cart</h1> <p>router.register( r'shopcarts' , ShoppingCartViewset, base )</p> <h1>Order related url</h1> <p>router.register( r'orders' , OrderViewset, base )</p> <h1>Home banner carousel url</h1> <p>router.register( r'banners' , BannerViewset, base )</p> <h1>Homepage series product display url</h1> <p>router.register( r'indexgoods' , IndexCategoryViewset, base )</p> <p>router.register(r'hotsearchs', HotSearchsViewset, base)</p> <h1>from VueDjangoFrameWorkShop.settings import STATIC_ROOT</h1> <p>urlpatterns = [ # path('admin/', admin.site.urls), path( 'xadmin/' , xadmin.site.urls), # Process the url displayed by the image, use Django's own serve, and pass in parameters to tell it which path to go to Find, we have the configured path MEDIAROOT re_path( 'media/(?P<path>.*)' , serve, { "document_root" : MEDIA_ROOT }), # Rich text related url path( 'ueditor/' , include( 'DjangoUeditor.urls' )),</p> <pre><code># Product list page # path('goods/', GoodsListView.as_view(),), # path('goods/', goods_list,), # router's path path re_path( '^' , include(router.urls)), # automated documentation, in version 1.11, be careful not to add the $ symbol path( 'docs/' , include_docs_urls(title= 'document' )) , # debug login path( 'api-auth/' , include( 'rest_framework.urls' )), # The token that comes with drf is authorized to log in. To obtain the token, you need to post the data path to this address ( 'api-token-auth/' , views.obtain_auth_token), # jwt's token authentication path( 'login/' , obtain_jwt_token), # Alipay payment related interface path( 'alipay/return/' , AlipayView.as_view()), path('index/', TemplateView.as_view(template_name='index.html'), name='index'), # re_path('static/(?P<path>.*)', serve, {"document_root": STATIC_ROOT}), # 3rd party login path( '' , include( 'social_django.urls' , namespace= 'social' )) </code></pre> <p>]

You may also like...

Leave a Reply

Your email address will not be published.