Skip to main content
 首页 » 编程设计

python之属性错误 : 'Settings' object has no attribute 'MERCHANT_SETTINGS'

2025年05月04日11jackei

我是 Django 的新手,正在关注 this github link创建一个接受付款的应用程序

我能够成功同步数据库,但是当我在 127.0.0.1:8000 运行服务器时,我在网页上看到以下错误。

AttributeError at / 
 
'Settings' object has no attribute 'MERCHANT_SETTINGS' 
Request Method: GET 
Request URL:    http://127.0.0.1:8000/ 
Django Version: 1.6.6 
Exception Type: AttributeError 
Exception Value:     
'Settings' object has no attribute 'MERCHANT_SETTINGS' 
Exception Location: /usr/local/lib/python2.7/dist-packages/django/conf/__init__.py in __getattr__, line 55 
Python Executable:  /usr/bin/python 
Python Version: 2.7.6 
Python Path:     
['/home/arjun/merchant-master/example', 
 '/usr/lib/python2.7', 
 '/usr/lib/python2.7/plat-x86_64-linux-gnu', 
 '/usr/lib/python2.7/lib-tk', 
 '/usr/lib/python2.7/lib-old', 
 '/usr/lib/python2.7/lib-dynload', 
 '/usr/local/lib/python2.7/dist-packages', 
 '/usr/lib/python2.7/dist-packages', 
 '/usr/lib/python2.7/dist-packages/PILcompat', 
 '/usr/lib/python2.7/dist-packages/gtk-2.0', 
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', 
 '/usr/lib/python2.7/dist-packages/ubuntuone-client', 
 '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', 
 '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol'] 

我可以在以下路径看到MERCHANT_SETTING

merchant/example/settings/local.py-dist 

谁能帮我弄清楚问题出在哪里?

请您参考如下方法:

您只需将必要的 MERCHANT_SETTINGS 添加到您的 Django settings.py 中。 这里商家installation doc .

因此,只需转到您的 settings.py,添加您的商家设置,如 merchant example file .