在我的本地开发环境中,一切正常。我没有收到Chrom-Dev控制台错误,但是在Heroku上,我的应用程序找不到某些文件。我正在使用Whitenoise,在我的模板中,这些文件被定义为静态文件:
本地开发环境
Heroku应用
此函数定义如下:
async function run() {
// load the models
await faceapi.loadMtcnnModel(`{% static 'models/mtcnn/mtcnn_model-weights_manifest.json' %}`);
await faceapi.loadFaceRecognitionmodel(`{% static 'models/fr/face_recognition_model-weights_manifest.json' %}`);
await faceapi.loadTinyFaceDetectorModel(`{% static 'models/fd/tiny_face_detector_model-weights_manifest.json' %}`);
navigator.mediaDevices.getUserMedia({audio: false,video: true}).then(stream => {
video.srcObject = stream;
video.play();
}).catch(e => console.warn(e));
}
模型在以下位置:
我应该配置什么,我可以告诉Whitenoice将这些文件包含在collectstatic命令中吗?还是我想念其他东西?我什至在Source选项卡的Chrome Dev Tool中都看不到Models文件夹。即使在本地开发环境中,尽管在本地开发中一切正常,但是在Heroku上却没有。
链接到heroku应用程序:https://gibbface.herokuapp.com/app/
链接到GitHub存储库:https://github.com/khashashin/gibbface