votes up 1

Application was not able to create a URL adapter for request independent URL generation. You might be able to fix this by setting the SERVER_NAME config variable.

Package:
flask
github stars 56479
Exception Class:
RuntimeError

Raise code

wise go with the url adapter from the appctx and make
    # the URLs external by default.
    else:
        url_adapter = appctx.url_adapter

        if url_adapter is None:
            raise RuntimeError(
                "Application was not able to create a URL adapter for request"
                " independent URL generation. You might be able to fix this by"
                " setting the SERVER_NAME config variable."
            )

        external = values.pop("_external", True)

    anchor =
😲 Agile task management is now easier than calling a taxi. #Tracklify

Ways to fix

votes up 0 votes down

Summary:

The application could not generate an external url for the application, due to some reasons.

To fix:

add the SERVER_NAME config variable to your app.cofig and set its value to your server name, the server name is the name and port number of your server.

Eg: If your server name is example.org:500,

then do this setting:

...
app = Flask(__name__)
...
app.config['SERVER_NAME'] = "example.org:5000"
...

The config can also be specified in your config file or object if you prefer alternate methods of configuration.

Jun 02, 2021 cRyp70s answer
cRyp70s 113

Add a possible fix

Please authorize to post fix