Yaswanth56 commited on
Commit
f979400
·
verified ·
1 Parent(s): 19782fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -14,9 +14,6 @@ SF_PASSWORD = os.getenv('SF_PASSWORD')
14
  SF_SECURITY_TOKEN = os.getenv('SF_SECURITY_TOKEN')
15
  SF_DOMAIN = os.getenv('SF_DOMAIN')
16
 
17
- if __name__ == '__main__':
18
- app.run(host="0.0.0.0", port=7860, debug=True)
19
-
20
  # Salesforce connection
21
  try:
22
  print("Attempting Salesforce connection...")
@@ -32,11 +29,13 @@ except Exception as e:
32
  # Route for login page
33
  @app.route('/')
34
  def login():
 
35
  return render_template('login.html')
36
 
37
  # Route to process login
38
  @app.route('/auth', methods=['POST'])
39
  def auth():
 
40
  email = request.form['email']
41
  password = request.form['password']
42
 
@@ -62,6 +61,7 @@ def auth():
62
  # Route to display rewards page
63
  @app.route('/rewards/<customer_id>')
64
  def rewards(customer_id):
 
65
  try:
66
  customer = sf.Customer_Login__c.get(customer_id)
67
  points = customer['Reward_Points__c']
@@ -74,6 +74,7 @@ def rewards(customer_id):
74
  # Route to apply rewards
75
  @app.route('/apply_rewards', methods=['POST'])
76
  def apply_rewards():
 
77
  customer_id = request.form['customer_id']
78
  bill_amount = float(request.form['bill_amount'])
79
  apply_rewards = request.form.get('apply_rewards')
@@ -118,4 +119,4 @@ def apply_rewards():
118
  return f"Error applying rewards: {e}"
119
 
120
  if __name__ == '__main__':
121
- app.run(debug=True, host="0.0.0.0", port=5000)
 
14
  SF_SECURITY_TOKEN = os.getenv('SF_SECURITY_TOKEN')
15
  SF_DOMAIN = os.getenv('SF_DOMAIN')
16
 
 
 
 
17
  # Salesforce connection
18
  try:
19
  print("Attempting Salesforce connection...")
 
29
  # Route for login page
30
  @app.route('/')
31
  def login():
32
+ print("Login route accessed") # Debug statement
33
  return render_template('login.html')
34
 
35
  # Route to process login
36
  @app.route('/auth', methods=['POST'])
37
  def auth():
38
+ print("Auth route accessed") # Debug statement
39
  email = request.form['email']
40
  password = request.form['password']
41
 
 
61
  # Route to display rewards page
62
  @app.route('/rewards/<customer_id>')
63
  def rewards(customer_id):
64
+ print(f"Rewards route accessed for customer {customer_id}") # Debug statement
65
  try:
66
  customer = sf.Customer_Login__c.get(customer_id)
67
  points = customer['Reward_Points__c']
 
74
  # Route to apply rewards
75
  @app.route('/apply_rewards', methods=['POST'])
76
  def apply_rewards():
77
+ print("Apply rewards route accessed") # Debug statement
78
  customer_id = request.form['customer_id']
79
  bill_amount = float(request.form['bill_amount'])
80
  apply_rewards = request.form.get('apply_rewards')
 
119
  return f"Error applying rewards: {e}"
120
 
121
  if __name__ == '__main__':
122
+ app.run(debug=True, host="0.0.0.0", port=7860)