views:

75

answers:

3

I set a variable MAX_REQUEST = 100 in settings.py

I write a middleware which may lower this value for request origining from a proxy ip address by the following code:

settings.MAX_REQUEST = 10

However, looks like the above modification affects all legitimate users.

Is it normal?

+3  A: 

Yes. settings is a module referenced all over by Django (and probably your code too). Modifying any variable in settings is like modifying a global variable and alters the behaviour of your whole web app.

pajton
A: 

Django settings are global. They affect the whole process.

Ignacio Vazquez-Abrams
A: 

If you want 'per user' variables, I suggest you look at How to use sessions.

Alasdair