问题描述
我同时运行 vue 和 django。 我已经安装了 webpack_loader 并将其安装在已安装的应用程序中。 我在 settings.py
中有 WEBPACK_LOADERWEBPACK_LOADER = {
'DEFAULT': {
'BUNDLE_DIR_NAME': 'dist/','STATS_FILE': os.path.join(BASE_DIR,'frontend','webpack-stats.json'),}
}
frontend 是创建 vue 时的名字。 以下是更多详情KeyError at / 'assets' and ModuleNotFoundError: No module named 'webpack_loader'
我来自 http://localhost:8000/ 的页面源看起来像这样
<!DOCTYPE html>
<html lang="en">
<head>
<Meta charset="UTF-8">
<Meta http-equiv="X-UA-Compatible" content="IE=edge">
<Meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>QuestionTime</title>
</head>
<body>
<h1>Vue JS</h1>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="http://0.0.0.0:8080/bundle.js" ></script>
</body>
</html>
我来自 http://localhost:8080/ 的页面源看起来像这样
<!DOCTYPE html>
<html lang="">
<head>
<Meta charset="utf-8">
<Meta http-equiv="X-UA-Compatible" content="IE=edge">
<Meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<title>hello-vue</title>
<link href="/js/about.js" rel="prefetch"><link href="/js/app.js" rel="preload" as="script"><link href="/js/chunk-vendors.js" rel="preload" as="script"></head>
<body>
<noscript>
<strong>We're sorry but hello-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="/js/chunk-vendors.js"></script><script type="text/javascript" src="/js/app.js"></script></body>
</html>
当我使用 (django-webpack-loader 1.0.0) 时,我得到 KeyError at /
当我使用 (django_webpack-loader 0.7.0) 时,我没有收到任何错误,但是 vue 代码没有显示出来(但我在 localhost:8080 看到了它)。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)