(1)在命令行界面输入下列指令,创建Django应用——appName:
- $ django-admin startproject appName
(2)进入创建的项目,创建应用app——childName:
- $ cd appName
- $ python manage.py startapp childName
(3)在appName的跟目录,利用vue-cli创建vue应用——vueName:
- $ vue-init webpack vueName
(4)进入vueName,安装模块并打包:
- $ cd vueName
- $ cnpm install
- $ cnpm run build
(5) 找到Django应用——appName根目录里的urls.py(即appName/urls.py),配置url路径:
- from django.contrib import admin
- from django.urls import path
- from django.views.generic.base import TemplateView
- urlpatterns = [
path(‘admin/’, admin.site.urls),
path(r’’, TemplateView.as_view(template_name=