- Reading, writing, and using tests
- Demonstrating understanding of the client-server model, request-response cycle and conventional RESTful routes
- Driving development with independent research, experimentation, and collaboration
- Reading and using existing external web APIs
- Using Postman as part of the development workflow
Working with the Flask package:
- Creating models
- Creating conventional RESTful CRUD routes for a model
- Reading query parameters to create custom behavior
- Create unconventional routes for custom behavior
- Apply knowledge about making requests in Python, to call an API inside of an API
- Apply knowledge about environment variables
- Creating a one-to-many relationship between two models
There's so much we want to do in the world! When we organize our goals into smaller, bite-sized tasks, we'll be able to track them more easily, and complete them!
If we make a web API to organize our tasks, we'll be able to create, read, update, and delete tasks as long as we have access to the Internet and our API is running!
We also want to do some interesting features with our tasks. We want to be able to:
- Sort tasks
- Mark them as complete
- Get feedback about our task list through Slack
- Organize tasks with goals
... and more!
- Python
- Flask
- pip
- SQLAlchemy
- Fork this project repo to your own personal account
- Clone this new forked project
Create a virtual environment:
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ # You're in activated virtual environment!
Install dependencies (we've already gathered them all into a requirements.txt
file):
(venv) $ pip install -r requirements.txt
Create two databases:
- A development database named
task_list_api_development
- A test database named
task_list_api_test
Create a file named .env
.
Create two environment variables that will hold your database URLs.
SQLALCHEMY_DATABASE_URI
to hold the path to your development databaseSQLALCHEMY_TEST_DATABASE_URI
to hold the path to your development database
Your .env
may look like this:
SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://postgres:postgres@localhost:5432/task_list_api_development
SQLALCHEMY_TEST_DATABASE_URI=postgresql+psycopg2://postgres:postgres@localhost:5432/task_list_api_test
Run $ flask db init
.
After you make your first model in Wave 1, run the other commands migrate
and upgrade
.
Check that your Flask server can run with $ flask run
.
We can run the Flask server specifying that we're working in the development environment. This enables hot-reloading, which is a feature that refreshes the Flask server every time there is a detected change.
$ FLASK_ENV=development flask run
It is highly recommended to run the Flask servers with this command.
This project is designed to fulfill the features described in detail in each wave. The tests are meant to only guide your development.