I have created a webapp with an authentication system. I use the session module to check if a user is logged in. During the login phase, I set session['logged_id'] = True, and when a client tries to access the homepage, I check if session['logged_in'] is equal to True. But after creating an account, when I try to access the homepage, through the login page, I am redirected to the login page again, even though the password is correct. So, I think session['logged in'] still false
The WebApp works fine in development server, but does't work in a production server, in this case nginx and gunicorn as wsgi server.
So I don't think it's a code related issue, but related to the nginx or gunicorn configuration
This is my nginx configuration file
server {
listen 80;
server_name 192.168.1.15;
location / {
include proxy_params;
proxy_pass http://unix:/home/pi/website/ris2023/ris.sock;
}
}
This is my gunicorn service file
[Unit]
Description=istanza di gunicorn per eseguire l'applicazione flask
After = network.target
[Service]
User = pi
Group = www-data
WorkingDirectory = /home/pi/website/ris2023
Environment = "PATH=/home/pi/website/ris2023/venv/bin"
ExecStart=/home/pi/website/ris2023/venv/bin/gunicorn --workers 3 --bind unix:ris.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
I have tried with flask-login too, but i have the same issue