Skip to content

veronicani/flask-cafe

Repository files navigation

Flask Cafe ☕️


Demo recording

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 ▶️ · Report Bug 🐛 · Request Feature 🙏

Top Languages GitHub repo size GitHub code size in bytes Contributors GitHub last commit

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contact
  5. Acknowledgments

About The Project

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.

(back to top)

Built With

Front-end:

  • jQuery
  • Bootstrap
  • SASS
  • Jinja

Back-end:

  • Python
  • Flask
  • GMaps API
  • PostgresQL
  • ElephantSQL
  • SQLAlchemy

(back to top)

Getting Started

To get a local copy up and running, please follow these steps.

  1. Clone this repo.
    git clone https://github.com/veronicani/flask-cafe.git
  2. To install dependencies into a virtual environment (venv), create / activate venv in the project directory. To create new venv
    $ python3 -m venv venv
    To activate venv:
    $ source venv/bin/activate
  3. Install requirements.txt.
    (venv) $ pip3 install -r requirements.txt
    Note: this will override any previous installs in the venv.
  4. Run server.
    (venv) $ flask run -p 5000
    (For some macs, running on port 5000 will lead to an address conflict, so run on port 5001 instead)

Seeding Data

  1. Create new database (requires PostgresQL to be installed):
    createdb flask-cafe
  2. To reseed data:
    cd flask-cafe
  3. Enter iPython in terminal (while in venv):
    (venv) $ ipython
  4. Run seed file:
    In [1]: run seed.py

Running Tests

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

(back to top)

Roadmap

  • 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

(back to top)

Contact

Veronica Ni - veronicani.dev - [email protected]

LinkedIn - linkedin.com/in/veronicani

(back to top)

Acknowledgments

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!

(back to top)