django shopping cart

Hi,

As a beginner, I’m following a django ecommerce tutorial. What I have noticed, while also looking for more tutorials, is that a lot of ecommerce tutorials, use the session based shopping cart class instead of a models based shopping cart class.

I’m having a hard time figuring out why. Is it a speed thing and if so, would the use of HTMX compensate for the loss of speed when using the models based shopping cart?

Welcome @5020curious !

Typically not, it’s a “longevity” issue.

The benefit of using a session is that the session data can be cleared after the session expires. The expectation is that if a person abandons the cart (and the session), then the space used for storing that data can be freed.

The performance difference between the two is negligible for something like this, especially since one of the common session backends is the database.

Using HTMX is going to have no effect on the server at all. From the perspective of the server, HTMX is just another JavaScript framework.

1 Like