How to send parameters with URL to Python application(Flask) deployed on an Azure App Service?

Jiaqi Wu 0 Reputation points
2023-11-29T12:02:17.4666667+00:00

Hi all,

Really appreciate it if anyone could give me a favor.

I have deployed a Python 3.10 app on an Azure App Service and have created different routes. For some routes that do not contain parameters in the URL, everything works correctly, but for routes that have parameters, when I try to pass parameters via URL, the app does not respond, and I receive a 504 Gateway Timeout error.

Here is an example of one of my routes:

@app.route('/export', methods=['GET'])
def exportReport():
    param1 = request.args.get('p1', "default_projectID")
    param2 = request.args.get('p2', "default_projectName")
    param3 = request.args.get('p3', "default_userName")
    ds, so join needed
    return render_template('index.html')

Here is an example of a URL that I am using to pass parameters to my app:

  azureflask-xxxx.net/export?p1=value1&p2=value2&p3=value3

Can anyone help me understand why this is happening? Thank you for any suggestions in advance!

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,361 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 24,736 Reputation points Microsoft Employee
    2023-12-01T15:17:24.2766667+00:00

    Thanks for posting this question. Just to clarify, do the same config/code works fine locally?
    You have a line that says “ds, so join needed”; you may test/validate by removing anything between the parameter gets and the return statement.

     

    To fetch more info, you may leverage App Service diagnostics from Azure Portal> Navigate to your App Service app in the Azure Portal.
    -In the left navigation, click on Diagnose and solve problems - Review and run – ‘Availability and Performance’,   ‘Network troubleshooter’ and ‘Configuration and Management’

    Also, review Enable and review logs to fetch more details about the error.

    0 comments No comments