VUE打包配置
const { defineConfig } = require(‘@vue/cli-service’)
module.exports = defineConfig({
transpileDependencies: true,
// publicPath:“/task/”
publicPath: ‘./’,
outputDir: ‘dist’,
assetsDir: ‘static’,}
django 配置
url:
from django.views.generic import TemplateView
path(‘’, TemplateView.as_view(template_name=‘index.html’), name=‘index’),#vue
setting.py
# 配置VUE打包文件
STATIC_ROOT = os.path.join(BASE_DIR, ‘static’)
STATICFILES_DIRS = [
os.path.join(BASE_DIR, “dist/static”),
]
‘DIRS’: [os.path.join(BASE_DIR, ‘dist’)]