Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -497,8 +497,21 @@ def remove_cart_item(item_name): 
     | 
|
| 497 | 
         
             
                    print(f"Error: {str(e)}")
         
     | 
| 498 | 
         
             
                    return jsonify({'success': False, 'message': f"An error occurred: {str(e)}"}), 500
         
     | 
| 499 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 500 | 
         
             
            @app.route('/api/addons', methods=['GET'])
         
     | 
| 501 | 
         
             
            def get_addons():
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 502 | 
         
             
                item_name = request.args.get('item_name')  # Fetch the requested item name
         
     | 
| 503 | 
         
             
                if not item_name:
         
     | 
| 504 | 
         
             
                    return jsonify({"success": False, "error": "Item name is required."})
         
     | 
| 
         @@ -701,4 +714,4 @@ def order_summary(): 
     | 
|
| 701 | 
         
             
                    return render_template("order.html", order=None, error=str(e))
         
     | 
| 702 | 
         | 
| 703 | 
         
             
            if __name__ == "__main__":
         
     | 
| 704 | 
         
            -
                app.run(debug= 
     | 
| 
         | 
|
| 497 | 
         
             
                    print(f"Error: {str(e)}")
         
     | 
| 498 | 
         
             
                    return jsonify({'success': False, 'message': f"An error occurred: {str(e)}"}), 500
         
     | 
| 499 | 
         | 
| 500 | 
         
            +
            import logging
         
     | 
| 501 | 
         
            +
             
     | 
| 502 | 
         
            +
            # Set up logging to the console
         
     | 
| 503 | 
         
            +
            logging.basicConfig(level=logging.DEBUG)  # You can change the level to INFO, WARNING, ERROR as needed
         
     | 
| 504 | 
         
            +
             
     | 
| 505 | 
         
             
            @app.route('/api/addons', methods=['GET'])
         
     | 
| 506 | 
         
             
            def get_addons():
         
     | 
| 507 | 
         
            +
                # Fetch the requested item name, category, and section
         
     | 
| 508 | 
         
            +
                item_name = request.args.get('item_name')  
         
     | 
| 509 | 
         
            +
                category = request.args.get('category')    
         
     | 
| 510 | 
         
            +
                section = request.args.get('section')      
         
     | 
| 511 | 
         
            +
             
     | 
| 512 | 
         
            +
                # Log the incoming parameters for debugging
         
     | 
| 513 | 
         
            +
                logging.debug(f"Item Name: {item_name}, Category: {category}, Section: {section}")
         
     | 
| 514 | 
         
            +
             
     | 
| 515 | 
         
             
                item_name = request.args.get('item_name')  # Fetch the requested item name
         
     | 
| 516 | 
         
             
                if not item_name:
         
     | 
| 517 | 
         
             
                    return jsonify({"success": False, "error": "Item name is required."})
         
     | 
| 
         | 
|
| 714 | 
         
             
                    return render_template("order.html", order=None, error=str(e))
         
     | 
| 715 | 
         | 
| 716 | 
         
             
            if __name__ == "__main__":
         
     | 
| 717 | 
         
            +
                app.run(debug=True, host="0.0.0.0", port=7860)
         
     |