Monday, April 26, 2021

DEFAULT Django Session is still using File in /tmp (Can't read from directory)

I've wired up a Django 3.0.1 Application using the default, DB-backed session configurations.

MIDDLEWARE has "django.contrib.sessions.middleware.SessionMiddleware",
INSTALLED_APPS has "django.contrib.sessions".

During file import (using django-import-export) I see that while session records are appearing in a database (SQL Server) table (dbo.django_session).

However, the application crashes with the error stating that it is unable to read the session data stored in "/tmp". These session files are saved with permissions "rw-------".

I've tried the following commands to enforce file readability from this directory:

    umask 002
    chmod g+s /tmp
    setfacl -d -m u::rw,g::rw,o::rw /tmp

but some process (either django, or the web server) keeps writing to the folder as "rw-------", after which the app crashes because it cannot read the file.

The primary issue I bring up is that despite DEFAULT session configuration (DB-backed sessions), Django is still referring to files.

My secondary issue is a question to anyone about how to ensure that session data being written to /tmp can be read.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7bfe6f01-0d49-44d6-b4d3-d1f46e4b508fn%40googlegroups.com.

No comments:

Post a Comment