Use Flask To Build a WebApp
Run the following two commands.
python3 -m pip install lxml
python3 -m pip install flask
If you are on windows - you might need to run the lxml
installerfrom this link
If that doesn't work for you - Google your error message.
Windows: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
We'll have to figure out how to get the menu information from the dining hall website.
Let's navigate to an example menu page for Foothill here
Let's get python to read it.
Open caldining.py
and let's figure out how to use lxml
to get the data.
Run this command in your terminal
python3 server.py
You should see something like
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat...
Then open your webbrowser and navigate to http://localhost:5000
- Let's create a new route
- Let's create a route with a parameter
Instead of return 'hello'
Let's try return render_template('home.html')
<h1> Here's whats avaialble today at {{ name }} </h1>