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)
Serve angular production application from python flask backend. Quick and Easy

Serve angular production application from python flask backend. Quick and Easy

mark 1 Dec 01, 2022
A Cyberland server written in Python with Flask.

Cyberland What is Cyberland Cyberland is a textboard that offers no frontend. Most of the time, the user makes their own front end. The protocol, as f

Maxime Bouillot 9 Nov 26, 2022
Adds SQLAlchemy support to Flask

Flask-SQLAlchemy Flask-SQLAlchemy is an extension for Flask that adds support for SQLAlchemy to your application. It aims to simplify using SQLAlchemy

The Pallets Projects 3.9k Dec 29, 2022
Flask + marshmallow for beautiful APIs

Flask-Marshmallow Flask + marshmallow for beautiful APIs Flask-Marshmallow is a thin integration layer for Flask (a Python web framework) and marshmal

marshmallow-code 770 Jan 05, 2023
An extension to add support of Plugin in Flask.

An extension to add support of Plugin in Flask.

Doge Gui 31 May 19, 2022
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

Tactful.ai 18 Nov 26, 2022
Template for a rest app with flask, flask-rest and more...

Flask REST Template About the project (some comments): The ideia behind the project is to create an useful and simple template for an rest app . Besid

107 Nov 16, 2022
Adds Injector support to Flask.

Flask-Injector Adds Injector support to Flask, this way there's no need to use global Flask objects, which makes testing simpler. Injector is a depend

Alec Thomas 246 Dec 28, 2022
A simple demo of using aiogram + async sqlalchemy 1.4+

aiogram-and-sqlalchemy-demo A simple demo of using aiogram + async sqlalchemy 1.4+ Used tech: aiogram SQLAlchemy 1.4+ PostgreSQL as database asyncpg a

Aleksandr 68 Dec 31, 2022
A simple barcode and QR code generator built in Python with Flask.

✨ Komi - Barcode & QR Generator ✨ A simple barcode and QR code generator built in Python with Flask. 📑 Table of Contents Usage Installation Contribut

Bonnie Fave 2 Nov 04, 2021
REST API with mongoDB and Flask.

Flask REST API with mongoDB py 3.10 First, to install all dependencies: python -m pip install -r requirements.txt Second, into the ./src/ folder, cop

Luis Quiñones Requelme 3 Mar 05, 2022
Connect is a Python Flask project within the cloud-native ecosystem

Connect is a Python Flask project within the cloud-native ecosystem. Second project of Udacity's Cloud Native Nanodegree program, focusing on documenting and architecting a monolith migration to micr

Lauren Ferreira 3 Feb 28, 2022
Flask RESTful Web services using API to communicate between client and server.

Welcome! Open up two terminals, one for client and for server each Terminal 1 Terminal 2 Now navigate to the CW2_code directory in both like so $ cd C

Sehra Elahi 1 Nov 23, 2021
A service made with Flask and Python to help you find the weather of your favorite cities.

Weather-App A service made with Flask and Python to help you find the weather of your favorite cities. Features Backend using Flask and Jinja Weather

Cauã Rinaldi 1 Nov 17, 2022
Rate Limiting extension for Flask

Flask-Limiter Flask-Limiter provides rate limiting features to flask routes. It has support for a configurable backend for storage with current implem

Ali-Akber Saifee 922 Jan 08, 2023
Glauth management ui created with python/flask

glauth-ui Glauth-UI is a small flask web app i created to manage the minimal glauth ldap server. I created this as i wanted to use glauth for authenti

Nils Thiele 67 Nov 29, 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
Geometry Dash Song Bypass with Python Flask Server

Geometry Dash Song Bypass with Python Flask Server

pixelsuft‮ 1 Nov 16, 2021
REST API built using flask framework that used for managing bookmarks by individual users.

Bookmarks REST API REST API built using flask framework that used for managing bookmarks by individual users. API Consumers Note This app is built usi

Venkatesh Tantravahi 1 Dec 27, 2021
Full-Stack application that visualizes amusement park safety.

Amusement Park Ride Safety Analysis Project Proposal We have chosen to look into amusement park data to explore ride safety relationships visually, in

Michael Absher 0 Jul 11, 2021