我有一个django应用程序,正试图通过django项目加载前端。我的index.html是:
<link rel="icon" type="image/x-icon" href="favicon.ico">
{% load static %}
<link rel="stylesheet" href="{% static "styles.38614f36c93ac671679e.css" %}"></head>
<body>
<app-root></app-root>
{% load static %}
<script type="text/javascript" src="{% static "runtime.a66f828dca56eeb90e02.js" %}"></script><script type="text/javascript" src="{% static "polyfills.f3fc5ca24d1323624670.js" %}"></script><script type="text/javascript" src="{% static "scripts.5bde77e84291ce59c080.js" %}"></script><script type="text/javascript" src="{% static "main.e7b9143f2f482d6d3cc7.js" %}"></script></body>
</html>
并且在项目文件的settings.py中,我添加了静态文件设置:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
我的项目结构是:
apt.yml DCMS_API/ infra/ manage.py* odbc-cfg/ requirements.txt static/ templates/
Authorize/ facility/ manifest.yml Procfile runtime.txt
当我在cloudfoundry上传代码并尝试运行应用程序时,上面写着
ERR Not Found: /static/runtime.a66f828dca56eeb90e02.js
ERR Not Found: /static/styles.38614f36c93ac671679e.css
ERR Not Found: /static/polyfills.f3fc5ca24d1323624670.js
ERR Not Found: /static/scripts.5bde77e84291ce59c080.js
ERR Not Found: /static/main.e7b9143f2f482d6d3cc7.js
我错过了什么?
您是否运行了python manage.py collectstatic?