Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在启用哈希的情况下构建Angular 5到Django静态文件夹_Python_Django_Angular - Fatal编程技术网

Python 如何在启用哈希的情况下构建Angular 5到Django静态文件夹

Python 如何在启用哈希的情况下构建Angular 5到Django静态文件夹,python,django,angular,Python,Django,Angular,我有一个Django应用程序,它有一个由Django REST连接的5角前端 当前部署仅在禁用哈希的情况下工作(-output hashing none),因为在uls.py中,我只能访问模板文件夹中index.html(“ang_home.html”)的副本 ng build --prod --output-path .../backend/src/static/ --watch --output-hashing none --aot=false --env=prod 现在我想更改我的url

我有一个Django应用程序,它有一个由Django REST连接的5角前端

当前部署仅在禁用哈希的情况下工作(-output hashing none),因为在uls.py中,我只能访问模板文件夹中index.html(“ang_home.html”)的副本

ng build --prod --output-path .../backend/src/static/ --watch --output-hashing none --aot=false --env=prod
现在我想更改我的urls.py,以便直接访问django静态文件夹中新创建的index.html,以便使用哈希

url(r'^.*', TemplateView.as_view(template_name="ang_home.html"), name='home'),
当前的解决方案很烦人,因为每次更改我都必须手动将index.html代码复制到ang_home.html中

简:我想要

url(r'^.*', index.html in the static folder), name='home'),

我使用fswatch以简单的sh脚本的形式提出了一个不完美的解决方案。也许有人也有同样的问题,这很有帮助

printf "Index Updater\n"
fswatch -o ./backend/src/static/index.html | while read num ; \
  do \
    DATE=`date '+%Y-%m-%d %H:%M:%S'`
    printf "Copy updated index.html => ang_home.html @${DATE} \n"
    cp ./backend/src/static/index.html ./backend/src/templates/ang_home.html
  done

有什么问题吗?或者你想知道什么部分?url模式底部的
r'^'
将捕获所有不匹配的url(如果这是部分的话)。事实并非如此。我想在静态文件中将TemplateView.as_view(template_name=“ang_home.html”)更改为index.html