我在Heroku上使用bcrypt和我的Flask應用程序時出現問題。當我部署到Heroku並轉到登錄路由時,我得到500內部服務器錯誤。它在本地正常工作。我如何獲得在Heroku上運行的bcrypt包?Heroku上的Python bcrypt包給AttributeError:'module'對象沒有屬性'ffi'
ERROR in app: Exception on /login [POST]
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/app/.heroku/python/lib/python2.7/site-packages/flask_restful/__init__.py", line 477, in wrapper
resp = resource(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/flask/views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/flask_restful/__init__.py", line 587, in dispatch_request
resp = meth(*args, **kwargs)
File "/app/app.py", line 196, in post
elif bcrypt.check_password_hash(user.password, password):
File "/app/.heroku/python/lib/python2.7/site-packages/flask_bcrypt.py", line 193, in check_password_hash
return safe_str_cmp(bcrypt.hashpw(password, pw_hash), pw_hash)
File "/app/.heroku/python/lib/python2.7/site-packages/bcrypt/__init__.py", line 82, in hashpw
hashed = _bcrypt.ffi.new("char[]", 128)
AttributeError: 'module' object has no attribute 'ffi'
是否知道可能導致此問題的任何其他包?我沒有安裝py-bcrypt,但也面臨着同樣的錯誤信息。謝謝 – user3939059