mirror of
https://github.com/Asabeneh/30-Days-Of-Python.git
synced 2026-06-06 21:09:15 +08:00
commit
47dae826b9
@ -118,11 +118,6 @@ app = Flask(__name__)
|
||||
def home ():
|
||||
return '<h1>Welcome</h1>'
|
||||
|
||||
@app.route('/about')
|
||||
def about():
|
||||
return '<h1>About us</h1>'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# for deployment we use the environ
|
||||
# to make it work for both production and development
|
||||
@ -159,7 +154,7 @@ if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0', port=port)
|
||||
```
|
||||
|
||||
Now, we added the about route in the above code. How about if we want to render an HTML file instead of string? It is possible to render HTML file using the function *render_templae*. Let us create a folder called templates and create home.html and about.html in the project directory. Let us also import the *render_template* function from flask.
|
||||
Now, we added the about route in the above code. How about if we want to render an HTML file instead of string? It is possible to render HTML file using the function *render_template*. Let us create a folder called templates and create home.html and about.html in the project directory. Let us also import the *render_template* function from flask.
|
||||
|
||||
### Creating templates
|
||||
|
||||
@ -573,4 +568,4 @@ After this step you will get an application like [this](http://thirdaysofpython-
|
||||
|
||||
🎉 CONGRATULATIONS ! 🎉
|
||||
|
||||
[<< Day 25 ](../25_Day_Pandas/25_pandas.md) | [Day 27 >>](../27_Day_Python_with_mongodb/27_python_with_mongodb.md)
|
||||
[<< Day 25 ](../25_Day_Pandas/25_pandas.md) | [Day 27 >>](../27_Day_Python_with_mongodb/27_python_with_mongodb.md)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user