title: django session outside of views
body: <p>First off, before I want to get to the question, I want to say that if there is a more appropriate way to accomplish this, please let me know, since I'll probably be able to use that.</p>
  
  <p>Ok, so I in my application, I need to add a REST API to allow a user to login, change a few things, and logout without needing to use a browser. I figured that I would have the api_login view I wrote would return their session_key and then make then pass the session key back in for each request. For example then</p>
  
  <pre><code>def login(request):
      ... all the django auth code I have
      # login adds the information to the request right?
      login (request, user)
      return simplejson.dumps({'key': request.session.session_key})
  </code></pre>
  
  <p>The problem I face is try later to use the <code>session_key</code> as follows, but this fails strangely</p>
  
  <pre><code>key = request.GET['key']
  my_session = SessionStore(session_key=key)
  my_session.session_key == key
  &gt;&gt;&gt; True
  my_session.values()
  &gt;&gt;&gt; []
  my_session.session_key == key
  &gt;&gt;&gt; False
  </code></pre>
  
  <p>So as you can see, I retrieve the SessionStore object from the database with the proper key. But then when I try to retrieve any of the values from it, it returns empty and the even changes the underlying key in it. Any advice on this is appreciated.</p>