2017-02-09 51 views
0

我已閱讀此計算器Q&A但它沒有奏效,我的情況。Django-RQ + Braintree:提交結算

在我的方案中,我使用出色的軟件包django-rq將函數(submit_transaction_for_settlement(transaction_id))推送到redis隊列。此功能的工作是提交交易進行結算。

在沙盒中,無論何時執行此功能,我都會收到相同的錯誤:AttributeError: type object 'Configuration' has no attribute 'environment'

我試過agf's proposalinstantiate a new gateway for each transaction在我的功能,但它沒有工作!

也許這與redis隊列或工作環境的環境有關?

def submit_transaction_for_settlement(transaction_id): 
    from braintree import Configuration, BraintreeGateway 

    config = Configuration(environment=settings.BRAINTREE_ENVIRONMENT, merchant_id=settings.BRAINTREE_MERCHANT_ID, 
            public_key=settings.BRAINTREE_PUBLIC_KEY, private_key=settings.BRAINTREE_PRIVATE_KEY) 
    gateway = BraintreeGateway(config=config) 
    result = gateway.transaction.submit_for_settlement(transaction_id) 

回答

0

Ahrg!

我討厭在我發現自己是解決方案後回答問題和分鐘的時刻!

故障發生在運行rqworker的命令中。我使用的命令是python manage.py rqworker --worker-class rq.SimpleWorker,因爲我有this issue,因爲我使用了Python 2.7(或其他引起此問題的其他內容)。生成此問題的命令是python manage.py rqworker

現在升級到python 3.4,最後的命令就像一個魅力! 因此,運行python manage.py rqworker做了伎倆,沒有這樣的錯誤!

相關問題