pythondjangomezzaninecartridge

'WSGIRequest' object has no attribute 'cart' in django-cartridge


I am working on Django 1.10, Mezzanine 4.4.2 with Cartridge installed manually after installing Mezzanine. Now I am able to add the products and price through cartridge. But when I click on the BUY button it is giving me the following error:-

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

Also if I click on checkout option it shows me an empty cart and then again when I click on continue shopping it redirects me to the http://localhost:8000/shop/which I want to change.

Thanks in advance.


Solution

  • This problem is due to missing Cartridge's ShopMiddleware. Add this into your settings.py file :

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

    And if the issue further exists,then compare your settings.py file with This link.