当我在我的 Flask 应用程序上执行“工头启动”时,我遇到了这个问题。
(venv)Macbook-err:Example ld$ foreman start
14:01:50 web.1 | started with pid 1441
14:01:50 web.1 | Traceback (most recent call last):
14:01:50 web.1 | File "app.py", line 26, in <module>
14:01:50 web.1 | connect('mydata', host=os.environ.get('MONGOLAB_URI'))
14:01:50 web.1 | File "/Users/ld/Dropbox/Semester4/Example/venv/lib/python2.7/site-packages/mongoengine/connection.py", line 160, in connect
14:01:50 web.1 | register_connection(alias, db, **kwargs)
14:01:50 web.1 | File "/Users/ld/Dropbox/Semester4/Example/venv/lib/python2.7/site-packages/mongoengine/connection.py", line 54, in register_connection
14:01:50 web.1 | if "://" in host:
14:01:50 web.1 | TypeError: argument of type 'NoneType' is not iterable
14:01:50 web.1 | exited with code 1
14:01:50 system | sending SIGTERM to all processes
SIGTERM received
在我的 app.py (第 26 行)中,我有:
connect('mydata', host=os.environ.get('MONGOLAB_URI'))
app.logger.debug("Connecting to MongoLabs")
我这样heroku config | grep MONGOLAB_URI > .env
做了 .env 文件应该是合法的。
有什么建议么?