title: What are sessions? How do they work?
body: <p>I am just beginning to start learning web application development, using python. I am coming across the terms 'cookies' and 'sessions'. I understand cookies in that they store some info in a key value pair on the browser. But I have a little confusion regarding sessions, in a session too we store data in a cookie on the user's browser.</p>
  
  <p>For example - I login using <code>username='rasmus'</code> and <code>password='default'</code>. In such a case the data will be posted to the server which is supposed to check and log me in if authenticated. However during the entire process the server also generates a session ID which will be stored in a cookie on my browser. Now the server also stores this session ID in its file system or datastore. </p>
  
  <p>But based on just the session ID, how would it be able to know my username during my subsequent traversal through the site? Does it store the data on the server as a dict where the key would be a session ID and details like <code>username</code>, <code>email</code> etc. be the values?</p>
  
  <p>I am getting quite confused here. Need help.</p>