2016-11-11 83 views
0

我正在使用Django 1.10,Mezzanine 4.4.2在安裝Mezzanine之後手動安裝Cartridge。現在我可以通過墨盒添加產品和價格。但是,當我購買按鈕點擊它給我以下錯誤: -'WSGIRequest'對象在django-cartridge中沒有屬性'cart'

AttributeError at /shop/product/nike-blue/ 
'WSGIRequest' object has no attribute 'cart' 
Request Method: POST 
Request URL: http://localhost:8000/shop/product/nike-blue/ 
Django Version: 1.10.3 
Exception Type: AttributeError 
Exception Value:  
'WSGIRequest' object has no attribute 'cart' 
Exception Location: G:\Py_Envs\Racknole\Mezzanine_Trial\lib\site-packages\cartridge\shop\views.py in product, line 69 
Python Executable: G:\Py_Envs\Racknole\Mezzanine_Trial\Scripts\python.exe 
Python Version: 2.7.11 
Python Path:  
['G:\\Django_Projects\\RackNole\\Mezzanine_Trial\\project_name', 
'C:\\Windows\\SYSTEM32\\python27.zip', 
'G:\\Py_Envs\\Racknole\\Mezzanine_Trial\\DLLs', 
'G:\\Py_Envs\\Racknole\\Mezzanine_Trial\\lib', 
'G:\\Py_Envs\\Racknole\\Mezzanine_Trial\\lib\\plat-win', 
'G:\\Py_Envs\\Racknole\\Mezzanine_Trial\\lib\\lib-tk', 
'G:\\Py_Envs\\Racknole\\Mezzanine_Trial\\Scripts', 
'c:\\python27\\Lib', 
'c:\\python27\\DLLs', 
'c:\\python27\\Lib\\lib-tk', 
'G:\\Py_Envs\\Racknole\\Mezzanine_Trial', 
'G:\\Py_Envs\\Racknole\\Mezzanine_Trial\\lib\\site-packages'] 
Server time: Fri, 11 Nov 2016 11:11:07 +0000 

另外,如果我點擊結帳選項,它讓我看到一個空的購物車,然後當我再次點擊繼續購物重定向我我想改變的http://localhost:8000/shop/

在此先感謝。

+0

更新您的settings.py MIDDLEWARE_CLASSES比​​較你的settings.py文件。 –

回答

1

此問題是由於缺少Cartridge的ShopMiddleware。這種添加到您的settings.py文件:

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    ......., 
    ......., 
    'cartridge.shop.middleware.ShopMiddleware', 
) 

而且如果問題進一步存在,然後用This link.

相關問題