How do I start a session in a Python web application?

前端 未结 5 1949
盖世英雄少女心
盖世英雄少女心 2020-12-10 08:18

This question is based on this answer.

I\'m looking for a function similar to PHP\'s session_start() for Python. I want to access a dictionary like

5条回答
  •  猫巷女王i
    2020-12-10 08:36

    As someone who comes from PHP and is working his way into Python I can tell you that Django is a good way to start dealing with Python on the web. This is especially true if you've been using MVC frameworks in PHP. That said, Django has built in support for session management and is documented here:

    http://docs.djangoproject.com/en/dev/topics/http/sessions/

    And, out of curiousity, I took a look around for session management with plain python and found this:

    http://code.activestate.com/recipes/325484/

    Judging by the comments, it would seem that you're better off using one of the tried and true frameworks to handle this for you. If you're not interested in Django you can also checkout some of the others

提交回复
热议问题