简体   繁体   English

使用 Pyaudio 库将 Django 应用程序部署到 Heroku

[英]Deploy Django app using Pyaudio library to Heroku

I built a Django app for speech recognition, the app uses the user's microphone to record audio then convert it to text.我构建了一个用于语音识别的 Django 应用程序,该应用程序使用用户的麦克风录制音频,然后将其转换为文本。 It works well locally, but when I try to deploy it in Heroku it giving an error that Pyaudio can not install and command 'gcc' failed with exit status 1.它在本地运行良好,但是当我尝试在 Heroku 中部署它时,它给出了一个错误,即 Pyaudio 无法安装并且命令“gcc”失败,退出状态为 1。

I am using Python 3.6 and Windows 7. How can I deploy this application to Heroku?我正在使用 Python 3.6 和 Windows 7. 如何将此应用程序部署到 Heroku?

the app uses the user's microphone to record audio then convert it to text该应用程序使用用户的麦克风录制音频,然后将其转换为文本

This won't work on Heroku even if you manage to install Pyaudio.即使您设法安装了 Pyaudio,这也不适用于 Heroku。

Python code runs on the server , not in the browser. Python 代码在服务器上运行,而不是在浏览器中。 If you try to record audio using Pyaudio it will try to record audio in some data centre somewhere on Amazon Web Services.如果您尝试使用 Pyaudio 录制音频,它将尝试在 Amazon Web 服务上的某个数据中心录制音频。 This appears to work locally because in development your server and client are running on the same machine.这似乎在本地工作,因为在开发中您的服务器和客户端在同一台机器上运行。

If you want to record audio from your users you'll need to do it in JavaScript.如果您想录制用户的音频,您需要在 JavaScript 中进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM