It won’t let me open the web page from the Apache server using webbrowser

  apache, flask, python

I am testing to open a web page with an apache2 server.
It is a simple example, but I want to try how to open, for example, the google web page from my server.

The code would be the following:

from flask import Flask
import webbrowser
app = Flask(__name__)

@app.route('/example')
def example():
    webbrowser.open("https://www.google.es/")
    return "Hello word!"

I have the apache server configured with a domain and if I enter it appears correctly my website so apache is configured well.

If I test that same code outside of apache, that is, only with Flask. if the google page opens. I don’t know why apache doesn’t open the web page.

I’m using apache2, wsgi and Flask.

Can someone help me?

Source: Python Questions

LEAVE A COMMENT