Hi Avery,

Both Mezzanine and Cartridge have a "project template" used to create a new
project. Each have their own settings.py module you'd start with. In your
case I imagine the site started with Mezzanine's, and now you need the
extra bits needed for Cartridge, which you've already started adding by
including "cartridge.shop" in INSTALLED_APPS.

I'd recommended comparing the two settings modules for differences:

https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/project_template/settings.py
https://github.com/stephenmcd/cartridge/blob/master/cartridge/project_template/settings.py

In this case I think you'll find the error is due to missing Cartridge's
ShopMiddleware, which is responsible for attaching a cart object to the
current request:

https://github.com/stephenmcd/cartridge/blob/master/cartridge/project_template/settings.py#L351




On Tue, Jul 15, 2014 at 9:00 AM, Avery Laird <[email protected]> wrote:

> Hi,
>
> I've been in the process of integrating cartridge with an existing
> mezzanine project, and I've run into a bit of a problem. Here's the full
> traceback if anyone needs it:
>
> Environment:
>
>
> Request Method: POST
> Request URL: http://localhost:8000/product/cerealbox
>
> Django Version: 1.6.5
> Python Version: 2.7.5
> Installed Applications:
> (u'mezzanine.boot',
>  u'django.contrib.auth',
>  u'django.contrib.contenttypes',
>  u'django.contrib.redirects',
>  u'django.contrib.sessions',
>  u'django.contrib.sites',
>  u'django.contrib.sitemaps',
>  u'django.contrib.staticfiles',
>  u'mezzanine.conf',
>  u'mezzanine.core',
>  u'mezzanine.generic',
>  u'mezzanine.blog',
>  u'mezzanine.forms',
>  u'mezzanine.pages',
>  u'mezzanine.galleries',
>  u'mezzanine.twitter',
>  u'mezzanine.accounts',
>  u'cartridge.shop',
>  u'zebra',
>  u'filebrowser_safe',
>  u'grappelli_safe',
>  u'django.contrib.admin',
>  u'django.contrib.comments')
> Installed Middleware:
> (u'django.contrib.sessions.middleware.SessionMiddleware',
>  u'django.middleware.locale.LocaleMiddleware',
>  u'django.contrib.auth.middleware.AuthenticationMiddleware',
>  u'django.middleware.common.CommonMiddleware',
>  u'django.middleware.csrf.CsrfViewMiddleware',
>  u'django.contrib.messages.middleware.MessageMiddleware',
>  u'mezzanine.core.request.CurrentRequestMiddleware',
>  u'mezzanine.core.middleware.RedirectFallbackMiddleware',
>  u'mezzanine.core.middleware.TemplateForDeviceMiddleware',
>  u'mezzanine.core.middleware.TemplateForHostMiddleware',
>  u'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware',
>  u'mezzanine.core.middleware.SitePermissionMiddleware',
>  u'mezzanine.pages.middleware.PageMiddleware')
>
>
> Traceback:
> File
> "/home/avery/Websites/cerealBox/site/local/lib/python2.7/site-packages/django/core/handlers/base.py"
> in get_response
>   112.                     response = wrapped_callback(request,
> *callback_args, **callback_kwargs)
> File
> "/home/avery/Websites/cerealBox/site/local/lib/python2.7/site-packages/cartridge/shop/views.py"
> in product
>   67.                 request.cart.add_item(add_product_form.variation,
> quantity)
>
> Exception Type: AttributeError at /product/cerealbox
> Exception Value: 'WSGIRequest' object has no attribute 'cart'
>
> I'm not exactly sure what could be causing this problem, as I have made
> what I believe to be all the pertinent changes to the settings.py and
> urls.py files. I added this pattern to the urls.py file:
>
> _slash = ""
> urlpatterns += patterns("cartridge.shop.views",
>     url("^product/(?P<slug>.*)%s$" % _slash, "product",
> name="shop_product"),
>     url("^wishlist%s$" % _slash, "wishlist", name="shop_wishlist"),
>     url("^cart%s$" % _slash, "cart", name="shop_cart"),
>     url("^checkout%s$" % _slash, "checkout_steps", name="shop_checkout"),
>     url("^checkout/complete%s$" % _slash, "complete",
> name="shop_complete"),
>     url("^invoice/(?P<order_id>\d+)%s$" % _slash, "invoice",
>         name="shop_invoice"),
>     url("^invoice/(?P<order_id>\d+)/resend%s$" % _slash,
>         "invoice_resend_email", name="shop_invoice_resend"),
> )
>
>
> as well as this to the i18n_patterns:
>
> ("^shop/", include("cartridge.shop.urls")),
>     url("^account/orders/$", "cartridge.shop.views.order_history",
>         name="shop_order_history"),
>
>
>
> I also only get this error while attempting to make a purchase, the site
> runs fine the rest of the time. Thanks for any insight and/or help anyone
> could give!
>
> Cheers,
>
> Avery
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to