I need to manually add records to django_session table. With my own SQL.
Can I leave session_data column empty? What purpose does it serve?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
session_datacontains the actual data for the session. With Django sessions, the cookie that tracks the session actually just contains an ID, which points to a record in the database that contains the actual session data.session_datashould not be blank; you can store a blank string, but it should be serialized the same way the Django database backend does it. Unfortunately, this involves pickling the data (with Python’spicklemodule) and then converting that into a base-64 representation, so it may be non-trivial to do this outside of Python.Why must you use your own SQL? Why not write a script (preferably a management command) that taps into Django’s sessions framework to create your objects?