要访问Parse.com后端,我使用他们的Python sdk。 parse_rest依赖项列在requirements.txt中。在localhost上一切正常。在Heroku上,我收到了这个错误:
2015-01-31T13:34:34.349494+00:00 heroku[web.1]: Starting process with command `python manage.py runserver`
2015-01-31T13:34:36.767611+00:00 app[web.1]: Traceback (most recent call last):
2015-01-31T13:34:36.767628+00:00 app[web.1]: File "manage.py", line 5, in <module>
2015-01-31T13:34:36.767636+00:00 app[web.1]: File "/app/app/models.py", line 11, in <module>
2015-01-31T13:34:36.767634+00:00 app[web.1]: from app.models import User, Role
2015-01-31T13:34:36.767675+00:00 app[web.1]: from parse_rest.connection import register
2015-01-31T13:34:36.767703+00:00 app[web.1]: ImportError: No module named parse_rest.connection
2015-01-31T13:34:37.739205+00:00 heroku[web.1]: Process exited with status 1
2015-01-31T13:34:37.741006+00:00 heroku[web.1]: State changed from starting to crashed
如何解决这个问题?
requirements.txt
parse_rest
Authomatic==0.0.10
Flask==0.10.1
Flask-Assets==0.7
Flask-Bootstrap==3.0.3.1
Flask-Login==0.2.7
Flask-Mail==0.9.0
Flask-Migrate==1.1.0
Flask-Moment==0.2.1
Flask-MongoEngine==0.1.3-dev
Flask-OAuth==0.12
Flask-Principal==0.4.0
Flask-SQLAlchemy==1.0
Flask-Script==0.6.6
Flask-Security==1.6.9
Flask-Social==1.6.2
Flask-WTF==0.9.4
GraphLab-Create==1.0
Jinja2==2.7.1
Mako==0.9.1
MarkupSafe==0.18
PAM==0.4.2
Pillow==2.3.0
PyYAML==3.10
SQLAlchemy==0.8.4
Twisted-Core==13.2.0
Twisted-Web==13.2.0
WTForms==1.0.5
Werkzeug==0.9.4
alembic==0.6.2
apiclient==1.0.2
appengine==1.8.0.2
apt-xapian-index==0.45
argparse==1.2.1
backports.ssl-match-hostname==3.4.0.2
blinker==1.3
boto==2.33.0
bottle==0.12.0
chardet==1.0.1
colorama==0.2.5
cssmin==0.1.4
decorator==3.4.0
dirspec==13.10
environment==1.0.0
facebook-sdk==0.3.1
foursquare==20130707
github3.py==0.7.1
google-api-python-client==1.1
gunicorn==0.14.6
html5lib==0.999
httplib2==0.8
itsdangerous==0.23
joblib==0.7.1
jsmin==2.0.2
librato-metrics==0.4.9
lockfile==0.9.1
matplotlib==1.3.1
mixpanel-py==3.1.1
mock==0.8.0
mongoengine==0.8.7
nose==1.1.2
numpy==1.8.2
oauth==1.0.1
oauth2==1.5.211
oauth2client==1.1
oauthlib==0.6.0
paramiko==1.10.1
parse-rest==0.2.20141004
passlib==1.6.1
pexpect==3.1
poster==0.8.1
prettytable==0.7.2
psycopg2==2.5.1
pyOpenSSL==0.13
pyasn1==0.1.7
pyasn1-modules==0.0.5
pycrypto==2.6.1
pycups==1.9.66
pycurl==7.19.3
pygobject==3.12.0
pymongo==2.6.3
pyparsing==2.0.1
pyserial==2.6
python-apt==0.9.3.5
python-daemon==1.6
python-dateutil==1.5
python-debian==0.1.21-nmu2ubuntu2
python-gflags==2.0
python-twitter==1.1
pytz==2012c
reportlab==3.0
requests==2.0.0
requests-oauthlib==0.4.0
rsa==3.1.4
scikit-learn==0.14.1
scipy==0.13.3
simplejson==3.3.1
six==1.9.0
ssh-import-id==3.21
tornado==3.2.1
uritemplate==0.6
uritemplate.py==0.2.0
urllib3==1.6
vboxapi==1.0
virtualenv==1.11.4
webassets==0.7
wsgiref==0.1.2
zope.interface==4.0.5
heroku logs --source heroku --ps api
2015-01-31T11:42:12.775108+00:00 heroku[api]: Scale to web=1 by raven.project.mail@gmail.com
2015-01-31T11:49:00.466658+00:00 heroku[api]: Deploy e17c6b0 by raven.project.mail@gmail.com
2015-01-31T11:49:00.466658+00:00 heroku[api]: Release v10 created by raven.project.mail@gmail.com
2015-01-31T11:50:02.685571+00:00 heroku[api]: Scale to web=1 by raven.project.mail@gmail.com
2015-01-31T11:57:22.746654+00:00 heroku[api]: Deploy 1045723 by raven.project.mail@gmail.com
2015-01-31T11:57:22.746654+00:00 heroku[api]: Release v11 created by raven.project.mail@gmail.com
2015-01-31T12:02:22.886402+00:00 heroku[api]: Scale to web=1 by raven.project.mail@gmail.com
2015-01-31T13:27:58.625655+00:00 heroku[api]: Release v12 created by raven.project.mail@gmail.com
2015-01-31T13:27:58.625655+00:00 heroku[api]: Deploy 084c0ed by raven.project.mail@gmail.com
2015-01-31T13:29:46.730378+00:00 heroku[api]: Scale to web=1 by raven.project.mail@gmail.com
2015-01-31T13:34:29.324713+00:00 heroku[api]: Release v13 created by raven.project.mail@gmail.com
2015-01-31T13:34:29.324713+00:00 heroku[api]: Deploy 05a0e2c by raven.project.mail@gmail.com
2015-01-31T13:34:40.077161+00:00 heroku[api]: Scale to web=1 by raven.project.mail@gmail.com
答案 0 :(得分:0)
尝试在本地安装您的要求,甚至可以在一个新的virtualenv:
$ pip install -r requirements.txt
然后您将收到以下错误:
给出双重要求:parse-rest == 0.2.20141004(来自-r requirements.txt(第68行))(已经在parse-rest中(来自-r。) requirements.txt(第1行)),name =&#39; parse-rest&#39;)
删除无关的包声明可能不够。当我尝试在你的requirements.txt中安装其余的软件包时(顺便说一下这很长),根本找不到一些软件包。例如,瓶子版本0.12.0似乎已从索引中完全删除([安全问题?[]),0.12.1是最接近的。
您可能已经运行pip freeze
并最终得到了许多并非真正需要的要求。这是一个适合我的工作流程: