我已经开始制作一个在Heroku上运行的节点服务器。我试着用非官方的API。我编写了以下Python脚本来连接到API:
import duolingo
import simplejson as json
lingo = duolingo.Duolingo('harleyrowland')
print json.dumps(lingo.get_user_info())
我的节点服务器使用以下命令:
^{pr2}$这一切在当地都很好。在
当我把这个推给Heroku时,代码不起作用,我开始在Heroku日志中得到以下错误:
{ [Error: ImportError: No module named duolingo]
2016-10-06T00:02:32.133315+00:00 app[web.1]: traceback: 'Traceback (most recent call last):\n File "duoScript.py", line 1, in <module>\n import duolingo\nImportError: No module named duolingo\n',
executable: 'python',
options: null,
script: 'duoScript.py',
args: null,
exitCode: 1
}
因此,我继续Heroku API,发现我需要添加一个要求.txt文件。所以我做了:
duolingo-api==0.3
simplejson==3.8.2
但还是没用。然后我找到了this答案并添加了一个.buildpacks文件:
https://github.com/heroku/heroku-buildpack-python.git
https://github.com/heroku/heroku-buildpack-nodejs.git
我还是犯了同样的错误。在
知道是什么导致了这个错误吗?在
我想我会把我的程序文件也显示出来,以防出现问题:
web: node index.js
pipinstall: pip install -r requirements.txt
不带git push heroku master
的git push heroku master
的输出:
$ git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 288 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 5.9.1
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Downloading and installing node 5.9.1...
remote: Using default npm version: 3.7.3
remote:
remote: -----> Restoring cache
remote: Loading 2 from cacheDirectories (default):
remote: - node_modules
remote: - bower_components (not cached - skipping)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: -----> Caching build
remote: Clearing previous node cache
remote: Saving 2 cacheDirectories (default):
remote: - node_modules
remote: - bower_components (nothing to cache)
remote:
remote: -----> Build succeeded!
remote: ├── ejs@2.4.1 extraneous
remote: ├── emailjs@1.0.8 extraneous
remote: ├── express@4.13.3
remote: ├── http-status@0.2.3
remote: ├── nodemailer@1.4.0
remote: ├── nodemailer-smtp-transport@1.0.4
remote: ├── python-shell@0.4.0
remote: └── xoauth2@1.2.0
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 13M
remote: -----> Launching...
remote: Released v25
remote: https://arcane-anchorage-33274.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
尝试删除不推荐使用的heroku-buildpack-multi,并使用Heroku ^{} 命令:
相关问题 更多 >
编程相关推荐