Keep object along a session.

37 views
Skip to first unread message

Serena

unread,
Oct 20, 2015, 7:23:22 PM10/20/15
to Django users
Regards.

I need to create an object when a user connects to the system. and the object must manternerce alive until the user disconnects. This object is unique for each user connected to the system.

This object can not be serialized and changes its state throughout his life.

This object should be visible only from django, ie, only the server side.

I have read and all I've found is serialized and stored in session. but. thus, it does not work for me.

Thanks in advance.

Serena

unread,
Oct 20, 2015, 7:30:36 PM10/20/15
to Django users
sorry, typo.

Regards.

I need to create an object when a user connects to the system. and the object must be kept alive until the user disconnects. This object is unique for each user connected to the system.

This object can not be serialized and changes its state throughout his life.

This object should be visible only from django, ie, only the server side.

I have read and all I've found is serialized and stored in section. but. thus, it does not work for me.

Thanks in advance.

Gergely Polonkai

unread,
Oct 21, 2015, 2:09:29 AM10/21/15
to Django users

Hello,

in the runserver environment, each request is served by the same instance, so whatever object you create and leave referenced somehow (good luck on that) will stay alive until runserver is running. However, as soon as you move to a production environment, be it Apache's mod_python, gunicorn or whatever, the Python instance that served your first request may be dead by the time you issue your second one. And it gots worse when you begin to scale your application to multiple machines.

Why is that object not serializable? Is there really no way to make it so, or store it's data to either the session, on the disk or to a key-value store like Redis?

Best,
Gergely

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/816b2c09-9724-436a-89f9-6b200b1430cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages