DSatishchandra commited on
Commit
b4c2cbe
·
verified ·
1 Parent(s): a5ffa31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -1,7 +1,6 @@
1
  from flask import Flask, render_template, request, jsonify, redirect, url_for, session
2
  from flask.sessions import SecureCookieSessionInterface
3
  from salesforce import get_salesforce_connection
4
- from redis import Redis
5
  import os
6
 
7
  # Initialize Flask app and Salesforce connection
@@ -17,11 +16,11 @@ print("Salesforce connection established.")
17
  app.secret_key = os.getenv("SECRET_KEY", "sSSjyhInIsUohKpG8sHzty2q") # Replace with a secure key
18
 
19
  # Set session cookie policies
20
- app.config["SESSION_TYPE"] = "redis"
21
- app.config["SESSION_REDIS"] = Redis(host="localhost", port=6379) # Replace with Redis details
22
- app.config["SESSION_COOKIE_SAMESITE"] = "None"
23
- app.config["SESSION_COOKIE_SECURE"] = True
24
-
25
  Session(app)
26
 
27
  # Ensure secure session handling for environments like Hugging Face
 
1
  from flask import Flask, render_template, request, jsonify, redirect, url_for, session
2
  from flask.sessions import SecureCookieSessionInterface
3
  from salesforce import get_salesforce_connection
 
4
  import os
5
 
6
  # Initialize Flask app and Salesforce connection
 
16
  app.secret_key = os.getenv("SECRET_KEY", "sSSjyhInIsUohKpG8sHzty2q") # Replace with a secure key
17
 
18
  # Set session cookie policies
19
+ app.config["SESSION_COOKIE_PATH"] = "/" # Available across all routes
20
+ app.config["SESSION_COOKIE_DOMAIN"] = None # Let the browser determine the domain
21
+ app.config["SESSION_COOKIE_SECURE"] = False # Set to True if HTTPS
22
+ app.config["SESSION_COOKIE_HTTPONLY"] = True # Prevent JavaScript access
23
+ app.config["SESSION_PERMANENT"] = False # Do not use permanent sessions
24
  Session(app)
25
 
26
  # Ensure secure session handling for environments like Hugging Face