Hello, I'm in the process of switching my new development over to Django (goodbye PHP + my horribly mediocre custom framework). The only real tough problem to solve in getting the two sides of the application to play nice with eachother (for me) is session management. When I log in a user through the PHP side, I need them to stay logged in when they go to the Django side, obviously, and they need to take all their other session data with them. I've searched google, blogs, this group, and IRC and nothing has jumped out at me as a solution. I'd love to hear what some more experienced Django users think about my proposed solution:
1) Create a custom bit of middleware (or modify the authentication middleware) and a custom PHP session handler to tie the two together. I would have two columns for session data. One for PHP-serialized auth data and one for python-serialized auth data. Every time I save user data to the session in PHP (basically just the userid and some authorization rights), the session handler uses exec to call some sort of python code that creates the django-equivalent information, which I believe is just an object from the user model and returns the serialized version of that object (http:// www.djangoproject.com/documentation/authentication/#authentication-in-web-requests). I then save that object in to the column for python data along with the php data in the php column. On the Django side, I hook in to the authentication framework somehow so that any time the user session information is updated, I call some PHP code that generates the right bit of serialized data and then I insert that in the php column. So, some problems I see with my strategy already: -I don't know how hard it will be to trick the auth middleware to use my "special" phython-serialized auth data column instead of pulling stuff from the general session-data column like it will want to (or how hard it would be to just deserialize the current python data, add on my user data, reserialize and stick it back in). -I don't know how hard it will be to do the reverse operation from PHP to python -I see some concurrency issues cropping up with all of this trying to keep two versions of the same data going from two different languages/ sites. Does anyone see an easier way or maybe have some insight into how I might accomplish the serialization/pickling stuff? The good news is that if I can get it to work, I'll definitely be releasing my middleware changes and my PHP session handler for use by any other poor sap trying to stick their PHP and Django Authentications together. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

