我最近将Angular 4项目升级到Angular 5,然后升级到Angular6。在运行之前,
ng build --prod --build-optimizer --aot
Angular会在dist
等vendor.fa30abf0a6e84604aa92.bundle.js
文件夹中创建一些捆绑文件。但是,现在,在我运行相同的命令后,我发现dist
文件夹中似乎是一堆未优化的文件:
3rdpartylicenses.txt fontawesome-webfont.ttf main.js runtime.js.map Simple-Line-Icons.woff2 views-dashboard-dashboard-module-ngfactory.js
assets fontawesome-webfont.woff main.js.map Simple-Line-Icons.eot styles.js views-dashboard-dashboard-module-ngfactory.js.map
favicon.ico fontawesome-webfont.woff2 polyfills.js Simple-Line-Icons.svg styles.js.map
fontawesome-webfont.eot index.html polyfills.js.map Simple-Line-Icons.ttf vendor.js
fontawesome-webfont.svg logo.png runtime.js Simple-Line-Icons.woff vendor.js.map
这些文件很大,使我的网站加载非常缓慢。仅下载vendor.js需要10秒钟以上。有什么想法我做错了吗?
答案 0 :(得分:0)
R理查兹(R Richards),谢谢您的提示。我可以通过手动删除@csrf_exempt
def add_member(request,project_id,user_id):
project = get_object_or_404(Project, id=project_id)
user = get_object_or_404(User, id=user_id)
form = User(request.POST)
if request.method=='POST':
form = User(request.POST,instance=User)
if form.is_valid():
form.save()
return redirect('project:delete_index')
else:
form = User()
,然后运行来解决此问题:
angular.json