I am developing a Morse Code learning website using Django where users can translate text into Morse code, decode messages, and practice interactive lessons. The website also allows authenticated users to save their learning progress, recent translations, and lesson completion status. Most of the application works as expected, but I have encountered a problem with session persistence while users interact with the learning features. The issue appears only after users spend some time actively using the website.
The translator itself performs all conversions in the browser using JavaScript, while Django is responsible for authentication and storing user-specific information. When a logged-in user completes practice exercises or saves translation history, the information is temporarily available during the session. However, after continued use or after navigating between several pages, some session-related data unexpectedly disappears even though the user remains logged in. This causes progress tracking to become inconsistent.
To investigate, I verified that the session engine is configured correctly and confirmed that authentication remains valid throughout the user’s visit. Database records for user accounts remain intact, and there are no authentication errors in the logs. The problem seems limited to application data that is being stored in the session rather than permanent models. Because the behavior occurs intermittently, reproducing it consistently has been challenging.
I also reviewed middleware configuration, session expiration settings, and browser cookies to determine whether the session is being recreated unexpectedly. From what I can observe, the session cookie itself remains valid, but certain values stored in the session are no longer available after specific user actions. Since the issue only affects some session variables, I am unsure whether I am misunderstanding the intended use of Django sessions for this type of application.
The Morse Code website includes long practice sessions where users remain active for extended periods before saving their work. My goal is to maintain lightweight session data during practice while storing completed progress in the database when appropriate. Before redesigning this workflow, I would like to understand whether storing temporary learning state in Django sessions is the recommended approach or if there is a better pattern for applications with extended user interaction.
Has anyone experienced similar issues with Django session data appearing to reset or disappear while users remain authenticated? I would appreciate any guidance on best practices for session management, temporary application state, or debugging techniques that could help identify why session values are not persisting consistently in this type of interactive educational application. Sorry for long post!