Skip to content

Adding another route causes 404 on cloud deploy only #4

@kevinskrei

Description

@kevinskrei

Originally, In main.py there is a function named hello_world

@app.route('/')
def hello_world():
    return 'Hello, World!'

I added another function below

@app.route('/hello')
def hello_path():
    return "HELLO FROM PATH"

So the full script is as follows:

from flask import Flask
app = Flask(__name__)
app.debug = True
    
@app.route('/')
def hello_world():
    return 'Hello, World!'
    
@app.route('/hello')
def hello_path():
    return "HELLO FROM PATH"
    
if __name__ == '__main__':
    app.run()

When I run this on my localhost both endpoints work correctly and return their respective strings. However, after deploying via git to my azure website, I can only get the response from xxx.azurewebsites.net/ to work correctly (returns "Hello, World!"). When I try and hit xxx.azurewebsites.net/hello I get a 404 error.

I'm not sure why it only works with the default route in the cloud when everything works fine locally. Is this a setup issue? Is there anyway I can debug the routing issues on Azure?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions