Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8661679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:33:18+00:00 2026-06-12T16:33:18+00:00

It seems that module variables live as long as a process lives and do

  • 0

It seems that module variables live as long as a process lives and do not reset until the process restarts.

Here is my code which i expect to behave another way that it behaves now:

I have a module responsible for various SEO features like breadcrumbs and title, file fancy/utils.py:

class Seo:
    title = ['project name']

Later in my views i can add items to Seo.title (news.views for example):

from fancy.utils import Seo

def index(request, news_id):
    title.append('some specific title')
    ...

The point is that the variable Seo.title actually does not reset at every request, so it continues to append items to itself and it looks very strange to me (as i came from PHP).

Eventually if i hit F5 at the same page the title always grows up to smth huge and long.

What’s going on and what should i do?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:33:20+00:00Added an answer on June 12, 2026 at 4:33 pm

    It seems from your comments that you have totally misunderstood the execution model of Django.

    You can’t have data local to the request that you can somehow access from anywhere in the code. If you need data associated with a particular request, you should store it somewhere where the code running that request can retrieve it: perhaps in the session, perhaps in a temporary dictionary added onto the request object itself. Anything you store globally will be, well, global: visible to any request running inside the same process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that runClasses() doesn't terminate the code being tested even after the test
It seems that often I find that my code when moving either from one
It seems that it is not advisable to use <meta http-equiv=REFRESH CONTENT=3;url=url> for redirects
It seems that css animations on firefox are pixelating the edges of elements: Here
I have this Makefile that has a variables named MODULES which lists all the
Seems that lot of people already know that issue but I can not find
I'm using condition variables in threads that require a timeout. I didn't notice until
Seems that This will be an easy question for you but this problem is
Seems that even after unchecking the option in the PyDev/Debug preferenecs pane to launch
It seems that we can show layers and even use a different zPosition for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.