- Build and run a Flask application on your computer.
- Extend a Flask application to meet the unique requirements of different projects.
- Web Framework: software that is designed to support the development of web applications. Web frameworks provide built-in tools for generating web servers, turning Python objects into HTML, and more.
- Extension: a package or module that adds functionality to a Flask application that it does not have by default.
- Request: an attempt by one machine to contact another over the internet.
- Client: an application or machine that accesses services being provided by a server through the internet.
- Web Server: a combination of software and hardware that uses Hypertext Transfer Protocol (HTTP) and other protocols to respond to requests made over the internet.
- Web Server Gateway Interface (WSGI): an interface between web servers and applications.
- Template Engine: software that takes in strings with tokenized values, replacing the tokens with their values as output in a web browser.
This is a test-driven lab. Run pipenv install
to create your virtual
environment and pipenv shell
to enter the virtual environment. Then run
pytest -x
to run your tests. Use these instructions and pytest
's error
messages to complete your work in the server/
folder.
Instructions begin here:
- Design a Flask application that displays information from a database created using Flask-SQLAlchemy and Flask-Migrate.
flask db init
has already been run. You will need to direct your Flask app to a database atapp.db
, create models, run a migration withflask db revision --autogenerate -m'<your message>'
and create the database file withflask db upgrade
.- Your database should represent a zoo. There should be three tables:
animals
,zookeepers
, andenclosures
. - The
Animal
model should contain aname
, aspecies
, azookeeper
, and anenclosure
. - The
Zookeeper
model should contain aname
, abirthday
, and a list ofanimals
that they take care of. - The
Enclosure
model should contain anenvironment
(grass, sand, or water), anopen_to_visitors
boolean, and a list ofanimals
. - Your application should contain three views:
animal_by_id
,zookeeper_by_id
, andenclosure_by_id
. Their routes should beanimal/<int:id>
,zookeeper/<int:id>
, andenclosure/<int:id>
, respectively. - Each view should display all attributes as line items (
ul
). If there is a one-to-many relationship, each of the many should have its own line item. - A seed script,
server/seed.py
, has been provided to generate test data once your models have been built and migrated to a database. Make sure to run this so that there are resources for the test suite to visit.
Once all of your tests are passing, commit and push your work using git
to
submit.