Python web-app (Flask) to browse Tandoor recipes on the local network

Overview

RecipeBook - Tandoor

Python web-app (Flask) to browse Tandoor recipes on the local network. Designed for use with E-Ink screens.

For a version that works with Nextcloud Cookbook, please navigate to RecipeBook

Deploy with DockerLocal BuildScreenshotsUpcoming

Overview

I created this to access recipes from Tandoor and easily view them on Kindle's web browser whilst cooking. The view is designed for such screens, and is not as nice as the actual app. Therefore, accessing your Tandoor website with a mobile device or tablet would just as effectively provide kitchen access to your recipes. This project is not associated with Tandoor.

Please note that the web application is very basic and should not be run on untrusted networks. It is not designed to be exposed publicly.

The application reads data from Tandoor using its API, and a valid token must be provided. This is (an extension of) my first project using Flask and building Docker containers. Feedback is appreciated.

Supported Architectures

Pulling from DockerHub should provide the correct image for your system. The application is built on the python-alpine base image. The "tandoor" tag is necessary to pull the version build for use with Tandoor. See DockerHub Repository,

Images are available for the following architectures:

Architecture
x86-64
arm64
armhf

Application Setup

Install and run using docker, examples provided below. See LinuxServer.io and Docker for more information on Docker containers.

Access main page at :5000 . See below for changing port number.

Usage

This container uses data from your Tandoor instance by calling its API. Therefore, an appropriate API Token and URL are required for it to function. Data for the homepage will be saved, and only refreshing the data will require a valid token and URL. However, each recipe-page needs to use the API, and therefore Tandoor must be accessible.

Find your API Token at http:// /settings/#api

Example configurations to build container are shown below. Some Environmental Variables are listed with default values and do not need to be specified, Token and URL must be correctly set for the application to function. Healthcheck is optional.

docker-compose

---
version: "2"
services:
  recipe:
    image: nbpub/recipelook:tandoor
    container_name: recipebook
    ports:
      - 5000:5000
    environment:
      - TZ=America/Los_Angeles
      - PAGE_TITLE=Recipe Book
      - FONT_SMALL=30
      - FONT_LARGE=36
      - Token=PasteYourTokenHere
      - URL=http://localhost:8080/
    healthcheck:
      test: curl -I --fail http://localhost:5000 || exit 1
      interval: 300s
      timeout: 10s
      start_period: 5s
    restart: unless-stopped

docker cli (click here for more info)

docker run -d \
  --name=recipebook \
  -e TZ=America/Los_Angeles \
  -e PAGE_TITLE=Recipe Book \
  -e FONT_SMALL=30 \
  -e FONT_LARGE=36 \
  -e Token=PasteYourTokenHere
  -e URL=http://localhost:8080/
  -p 5000:5000 \
  --restart unless-stopped \
  nbpub/recipelook:tandoor

Parameters

Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate : respectively. For example, -p 5001:5000 would expose port 5000 from inside the container to be accessible from the host's IP on port 5001 outside the container.

Parameter Function
-p 5000:5000 Default Flask port. Internal port should not be changed.
-e TZ=America/Los_Angeles Set timezone for logging using tzdata.
-e PAGE_TITLE=Recipe Book Home page title. Displays on tab.
-e FONT_SMALL=30 Default size for "small" sections: Description and Keywords. Can be changed to any to adjust web-page display.
-e FONT_LARGE=36 Default size for "large" sections: Steps data. Can be changed to any to adjust web-page display.
-e Token=PasteYourTokenHere Default Token is an empty string. API calls will not work unless a valid token is provided.
-e URL=http://localhost:8080/ Default URL for Tandoor instance. This should be changed to the appropriate base URL for Tandoor.

Upcoming

Version 1.0 is released. If issues are found or enhancements dreamt, they will come here until pushed to a new version.

I do not use Tandoor, and built this application with recipes downloaded from the demo website. Therefore, many features may not be supported. Please open an issue if you have ideas for improvements or bug-fixes. Listed below are some limitations I am aware of, but there are likely many others I have not encountered. Thank you for your help!

Known Limitations

  • Support for non-text based Steps (Type = time / file / recipe)
  • Ratings and comments <- should be easy to integrate

Possible Future Improvements

  • Provide option to not load images by default. Restore image button will still be present.

  • Cache recipe data to reduce needed API calls, provide functionality without accessing Tandoor

    • More local storage vs Less network traffic
  • Clean up exception handling code

  • wget instead of curl for healthchecks - does this provide smaller docker image?

  • keyword handling

  • Add tests

  • clean up CSS styling

  • Volume binding for configuration folder, let user poke through directories

Screenshots

Home Page, lists all recipes

Home

Filter Button

Home

Text Search, recipe titles only

Home

Recipe Page example, with image

Home

Recipe Page example, without image

Home

Recipe Page example, single Step

Home

Recipe Page example, multipe Steps

Home

Recipe Page example, multipe Steps continued

Home

Error Page - Invalid API Token

Home

Error Page - Invalid URL

Home

Build Locally

Instructions may not be comprehensive. Docker deployment is recommended.

If you want to run RecipeBook without Docker, a python virtual environment is recommended. See Flask Installation for more details (and appropriate commands for Windows). Python 3.7 or newer is recommended.

  1. Download the code in the repository. Click the green code button at the top of the page for options.

  2. Extract the folder contents. Copy the files+folders within "app" directory and "requirements.txt" to a new directory. All other contents can be deleted.

  3. Move to newly made directory and create and activate venv.

$ cd newdirectory
$ python -m venv venv
$ . venv/bin/activate
  1. Install Flask, dependencies.
$ pip install -r requirements.txt
  1. Adjust Flask parameters as desired, see Flask Quickstart. A Flask Env file saves some typing when running the application. For example, if you only want the server to be visible from the local machine, remove FLASK_RUN_HOST=0.0.0.0 from the file. The port number (default, 5000) can be changed in this file, too.
$ nano .flaskenv

Note that all local variables associated with environmental variables can be modified by changing the code. See next step for an example

  1. Modify URL and API-Token variables. See lines 15 and 19 of Tandoor_Reader.py. URL=" " and Token=" " .

Optional - Modify other local variables that are typically specified by docker-container environmental variables. See lines 25-27 or the same file. Values can be changed by modifying the second entry in environ.get(" ", " " .

  1. Run! Open site in web browser (http://localhost:5000).
$ flask run
  1. Press Ctrl+C to stop server. Deactivate venv when finished.
$ deactivate
You might also like...
Lux Academy & Data Science East Africa Python Boot Camp, Building and Deploying  Flask Application Using Docker  Demo App.
Lux Academy & Data Science East Africa Python Boot Camp, Building and Deploying Flask Application Using Docker Demo App.

Flask and Docker Application Demo A Docker image is a read-only, inert template that comes with instructions for deploying containers. In Docker, ever

An python flask app with webserver example

python-flask-example-keepalive How it works? Basically its just a python flask webserver which can be used to keep any repl/herokuapp or any other ser

A Python chat app built with Flask that runs in the browser.

A Python chat app built with Flask that runs in the browser. Designed for local area networks that are not connected to the Internet.

Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Flask-Rebar combines flask, marshmallow, and swagger for robust REST services.

Flask-Rebar Flask-Rebar combines flask, marshmallow, and swagger for robust REST services. Features Request and Response Validation - Flask-Rebar reli

Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Flask Project Template A full feature Flask project template.

Flask Project Template A full feature Flask project template. See also Python-Project-Template for a lean, low dependency Python app. HOW TO USE THIS

A Fast API style support for Flask. Gives you MyPy types with the flexibility of flask
A Fast API style support for Flask. Gives you MyPy types with the flexibility of flask

Flask-Fastx Flask-Fastx is a Fast API style support for Flask. It Gives you MyPy types with the flexibility of flask. Compatibility Flask-Fastx requir

Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure.

Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure. All the required libraries are already installed easily to use in any big project.

Releases(v1.0)
Owner
null
flask-apispec MIT flask-apispec (🥉24 · ⭐ 520) - Build and document REST APIs with Flask and apispec. MIT

flask-apispec flask-apispec is a lightweight tool for building REST APIs in Flask. flask-apispec uses webargs for request parsing, marshmallow for res

Joshua Carp 617 Dec 30, 2022
Brandnew-flask is a CLI tool used to generate a powerful and mordern flask-app that supports the production environment.

Brandnew-flask is still in the initial stage and needs to be updated and improved continuously. Everyone is welcome to maintain and improve this CLI.

brandonye 4 Jul 17, 2022
Flask-app scaffold, generate flask restful backend

Flask-app scaffold, generate flask restful backend

jacksmile 1 Nov 24, 2021
flask-reactize is a boostrap to serve any React JS application via a Python back-end, using Flask as web framework.

flask-reactize Purpose Developing a ReactJS application requires to use nodejs as back end server. What if you want to consume external APIs: how are

Julien Chomarat 4 Jan 11, 2022
This is a small notes web app, with python and flask microframework. Using sqlite3

Python Notes App. This is a small web application maked with flask-python for add notes easily and quickly. Dependencies. You can create a virtual env

Eduard 1 Dec 26, 2021
Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development.

Flask-Starter Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development. It has all the r

Kundan Singh 259 Dec 26, 2022
Intranet de la Rez Flask web app

IntraRez Application Flask de l'Intranet de la Rez. Exigences Python : Probablement >= 3.10 à terme, pour l'instant >= 3.8 suffit ; Autres packages Li

null 3 Jul 3, 2022
Are-You-OK is a Flask-based, responsive Web App to monitor whether the Internet Service you care about is still working.

Are-You-OK Are-You-OK is a Flask-based, responsive Web App to monitor whether the Internet Service you care about is still working. Demo-Preview Get S

Tim Qiu 1 Oct 28, 2021
Flask-Discord-Bot-Dashboard - A simple discord Bot dashboard created in Flask Python

Flask-Discord-Bot-Dashboard A simple discord Bot dashboard created in Flask Pyth

Ethan 8 Dec 22, 2022
Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications.

Flask Sitemapper Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications. This allows you to create a nice and

null 6 Jan 6, 2023