| 27 | |
| 28 | @classmethod |
| 29 | def _get_storage_path(cls): |
| 30 | try: |
| 31 | return cls._storage_path |
| 32 | except AttributeError: |
| 33 | storage_path = ( |
| 34 | getattr(settings, "SESSION_FILE_PATH", None) or tempfile.gettempdir() |
| 35 | ) |
| 36 | # Make sure the storage path is valid. |
| 37 | if not os.path.isdir(storage_path): |
| 38 | raise ImproperlyConfigured( |
| 39 | "The session storage path %r doesn't exist. Please set your" |
| 40 | " SESSION_FILE_PATH setting to an existing directory in which" |
| 41 | " Django can store session data." % storage_path |
| 42 | ) |
| 43 | |
| 44 | cls._storage_path = storage_path |
| 45 | return storage_path |
| 46 | |
| 47 | def _key_to_file(self, session_key=None): |
| 48 | """ |