Python Forum
Flask - Opening second page via href is failing - This site can’t be reached - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Flask - Opening second page via href is failing - This site can’t be reached (/thread-9475.html)



Flask - Opening second page via href is failing - This site can’t be reached - rafiPython1 - Apr-11-2018

I have small Python Flask application which is running over IIS Windows server, when trying to navigate to second page I'm getting the error:
"This site can’t be reached"

IIS FastCGI is bending the website to http://10.235.244.92:97/ which is working as the main page

The problem is with the href:
<a href="http://127.0.0.1:5000/second">Open Second Page</a>
I tried also to modify It to below but Its not working
<a href="http://10.235.244.92:97/second">Open Second Page</a>

Below is the code:

Main:
-----
from flask import Flask, render_template
app = Flask(__name__, static_url_path="/static")
@app.route('/')
def home():
return render_template('home.html')

@app.route('/second')
def home2():
return render_template('Second.html')


if __name__ == '__main__':
app.run()

home:
-----
<!DOCTYPE html>
<html>
<body>
<h1><u> Website</u></h1>
<p>Hi, welcome to the Site</p>
<a href="http://127.0.0.1:5000/second">Open Second Page</a>
<p> </p>
<img src="/static/smiley.gif" width="50" height="50" align ="bottom" align="center">

</body>
</html>


RE: Flask - Opening second page via href is failing - This site can’t be reached - DeltadeDirac - Apr-11-2018

Change your HOME doc to:
<a href="<http://10.235.244.92:97/second >">Open Second Page</a>


RE: Flask - Opening second page via href is failing - This site can’t be reached - rafiPython1 - Apr-11-2018

Smile Tnx working