9

If I am setting up multiple django servers behind a load balancer, do I want the SECRET_KEY to be the same, different or does it matter at all? The docs are a little thin on exactly what this value is used for.

ThatAintWorking
  • 1,330
  • 20
  • 32

2 Answers2

6

I guess it must be the same. Here is related question: Django SECRET_KEY.

Basically secret key is used to validate various things send to client or put in session. So if your nodes would have different secret keys you would have client's session cleared everytime it is routed to new node (which is bad).

Community
  • 1
  • 1
jb.
  • 23,300
  • 18
  • 98
  • 136
5

SECRET_KEY is used in various places such as the session middleware. If all nodes must have access to the session information then they must share the same key.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358