Whether you're a student, a commuter in the morning rush, or a work-from-home employee looking for an afternoon pick-me-up, Flask Cafe has you covered with sweet treats, quick bites, and the best brews --with as much caffeine as FDA compliant-- in your neighborhood!
View Demo
Table of Contents
Flask Cafe is an app where users can browse and like local cafes. Cafe owners and admin users can add, edit, or delete a cafe. Menu specialties can be added, edited, or removed from a cafe.
To test out the demo, you can use:
- guest-username:
guest
- guest-password:
password
- admin-username:
admin
- admin-password:
secret
This is the fullstack Flask application with Jinja HTML templating and Google Maps API integration. It uses Bootstrap + SASS for styling, and is deployed through Render.
Topics explored in this project:
- Many-to-many relationships in SQLAlchemy
- Relational database design and modeling
- Google Maps API integration
- Bootstrap + SCSS styling
- User authentication / authorization
- Form validation with WTForms
- CSRF Protection on all POST routes
- Extensive test coverage, currently at 93% -> to be raised to 99%
This project a WIP -- Please refer to the roadmap for the list of features to be added in the future.
Front-end:
Back-end:
To get a local copy up and running, please follow these steps.
- Clone this repo.
git clone https://github.com/veronicani/flask-cafe.git
- To install dependencies into a virtual environment (venv), create / activate venv in the project directory.
To create new venv
To activate venv:
$ python3 -m venv venv
$ source venv/bin/activate
- Install requirements.txt.
Note: this will override any previous installs in the venv.
(venv) $ pip3 install -r requirements.txt
- Run server.
(For some macs, running on port 5000 will lead to an address conflict, so run on port 5001 instead)
(venv) $ flask run -p 5000
- Create new database (requires PostgresQL to be installed):
createdb flask-cafe
- To reseed data:
cd flask-cafe
- Enter iPython in terminal (while in venv):
(venv) $ ipython
- Run seed file:
In [1]: run seed.py
To run all tests:
(venv) $ python -m unittest -v
To run individual test case (e.g. CafeViewsTestCase):
(venv) $ python -m unittest -v tests.CafeViewsTestCase
To run individual test:
(venv) $ python -m unittest -v tests.CafeViewsTestCase.test_list
To run coverage: May need to install coverage:
(venv) $ pip install coverage
Run coverage:
(venv) $ coverage run -m unittest
To view simple coverage report in terminal:
(venv) $ coverage report
To view an HTML report:
(venv) $ coverage html
Then, open htmlcov/index.html in browser to see the report. Source: Flask Coverage Docs
- Test coverage currently at 93% -- boost this to at least 98%
- Allow cafes w/o specialties to add specialty
- Add feature to remove cafe specialties
- Implement search feature
- Add test suite for search
- Design model schema to allow for image upload
- Integrate AWS S3 for local image upload / storage
- More as needed
Veronica Ni - veronicani.dev - [email protected]
This is a project I completed during a 1 week sprint, with a starter codebase from Rithm School. Many thanks to the staff team and their excellent curriculum and support!