Ticket #5507: 5507_simple.diff

File 5507_simple.diff, 2.1 KB (added by Philippe Raoult, 17 years ago)

better patch, even has docs!

  • django/conf/global_settings.py

     
    287287SESSION_SAVE_EVERY_REQUEST = False                      # Whether to save the session data on every request.
    288288SESSION_EXPIRE_AT_BROWSER_CLOSE = False                 # Whether sessions expire when a user closes his browser.
    289289SESSION_ENGINE = 'django.contrib.sessions.backends.db'  # The module to store session data
    290 SESSION_FILE_PATH = '/tmp/'                             # Directory to store session files if using the file session module
     290SESSION_FILE_PATH = None                                # Directory to store session files if using the file session module. If set to None the backend will use a sensible default.
    291291
    292292#########
    293293# CACHE #
  • django/contrib/sessions/backends/file.py

     
    99    Implements a file based session store.
    1010    """
    1111    def __init__(self, session_key=None):
    12         self.storage_path = getattr(settings, "SESSION_FILE_PATH", tempfile.gettempdir())
     12        self.storage_path = getattr(settings, "SESSION_FILE_PATH", None)
     13        if not self.storage_path:
     14            self.storage_path = tempfile.gettempdir()
    1315
    1416        # Make sure the storage path is valid.
    1517        if not os.path.isdir(self.storage_path):
  • docs/sessions.txt

     
    4949``"django.contrib.sessions.backends.file"``.
    5050
    5151You might also want to set the ``SESSION_FILE_PATH`` setting (which
    52 defaults to ``/tmp``) to control where Django stores session files. Be
     52defaults to ``tempfile.gettempdir()``, most likely  ``/tmp``) to control where Django stores session files. Be
    5353sure to check that your Web server has permissions to read and write to
    5454this location.
    5555
Back to Top