Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,18 @@
|
|
1 |
-
from flask import Flask, render_template, request
|
2 |
-
from flask_session import Session # Import the Session class
|
3 |
-
from flask.sessions import SecureCookieSessionInterface # Import the class
|
4 |
from salesforce import get_salesforce_connection
|
5 |
-
import os
|
6 |
|
7 |
# Initialize Flask app and Salesforce connection
|
8 |
print("Starting app...")
|
9 |
app = Flask(__name__)
|
10 |
print("Flask app initialized.")
|
11 |
|
12 |
-
#
|
13 |
sf = get_salesforce_connection()
|
14 |
print("Salesforce connection established.")
|
15 |
|
16 |
-
# Set the secret key to handle sessions securely
|
17 |
-
app.secret_key = os.getenv("SECRET_KEY", "sSSjyhInIsUohKpG8sHzty2q") # Replace with a secure key
|
18 |
-
|
19 |
-
# Configure the session type
|
20 |
-
app.config["SESSION_TYPE"] = "filesystem" # Use filesystem for session storage
|
21 |
-
app.config["SESSION_COOKIE_SECURE"] = True # Ensure cookies are sent over HTTPS
|
22 |
-
app.config["SESSION_COOKIE_SAMESITE"] = "None" # Allow cross-site cookies
|
23 |
-
|
24 |
-
# Initialize the session
|
25 |
-
Session(app)
|
26 |
-
print("Session interface configured.")
|
27 |
-
|
28 |
-
# Ensure secure session handling
|
29 |
-
app.session_interface = SecureCookieSessionInterface()
|
30 |
-
print("Session interface configured.")
|
31 |
-
|
32 |
@app.route("/")
|
33 |
def home():
|
34 |
-
return render_template("
|
35 |
|
36 |
@app.route("/menu", methods=["GET"])
|
37 |
def menu():
|
|
|
1 |
+
from flask import Flask, render_template, request
|
|
|
|
|
2 |
from salesforce import get_salesforce_connection
|
|
|
3 |
|
4 |
# Initialize Flask app and Salesforce connection
|
5 |
print("Starting app...")
|
6 |
app = Flask(__name__)
|
7 |
print("Flask app initialized.")
|
8 |
|
9 |
+
# Salesforce Connection
|
10 |
sf = get_salesforce_connection()
|
11 |
print("Salesforce connection established.")
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
@app.route("/")
|
14 |
def home():
|
15 |
+
return render_template("menu.html") # Directly render the menu page
|
16 |
|
17 |
@app.route("/menu", methods=["GET"])
|
18 |
def menu():
|