title: Flask sessions don't persist in Debian/UWSGI server
body: <p>This is my first project trying to run a Flask app using UWSGI in my Debian server, and I'm really not able to decipher why my sessions don't keep the variables when I'm changing URLs. </p>
  
  <p>My code is similar to this:</p>
  
  <pre><code>...
  
  app.config['SERVER_NAME'] = "myserver.com"
  
  ...
  
  @app.route('/', methods=['GET', 'POST'])
  def login():
      if request.method == 'POST':
          username = request.form['username']
          session['username'] = username
          return render_template('query.html')
  
  @app.route('/do_query/&lt;query&gt;')
  def do_query(query):    
      if 'username' not in session:
          return redirect('/')
      ...
  
  app.secret_key = 'idjaon21ioj' 
  </code></pre>
  
  <p>As you can see, I tried to include the <code>SERVER_NAME</code> variable and to use a custom string in <code>app.secret_key</code> for testing purposes, since these two answers were given in similar questions regarding the same problem. But I still could make the <code>do_query()</code> function to find the <code>username</code> variable in the session object.</p>
  
  <p>What can my mistake be?</p>