/goobertools

Simple. Web. Apps.

Primary LanguagePython

This project attempts to build a suite of simple web apps.

Quickstart

In Windows, simply run in any cmd or cmder prompt:

> start_flask

Apps

Selector

selector randomly selects songs from a Google Sheet.

This app has a few main ideas:

  1. loading the page (GET) auto retrives data from a default url. It then locally writes two files: songs and shuffled dataset
  2. optionally select a data to override the default dataset (read a url or file)
  3. pushing the button (POST) selects from the shuffled data and removes the selection. This file rebuilds a shuffled dataset when it is depleted. The refresh button also rebuilds the shuffled dataset.

Data Options

The selector app can read data from Google Sheets (given a url) or from a selected file (.txt or .csv). Google Sheets must be published and the url to the .csv file must be used. If neither option is provided, a default Sheets url is used, which is saved in a private config file.

NOTE: although modifications to Google Sheets are saved instantaneously, changes are delayed to the Published url. Wait about 5 minutes to see resulting modifications in the app. For improved lag, modify and upload a local file.

DEPRECATED: the uploading files data option proved overly complex. If uploading a file is needed, upload to Google Docs and use the url data option.

Notes

  • data is only read as DataFrames from Google sheets; it is thereafter written and read locally as .csv files (e.g. db_* files).
  • db_* files are temporary, psuedo-"databases"; they are written to preserve persisted data between page loads and button presses and act as a substitute to actual databases.
  • _viz/: something that is lacking from many web app tutorials are pictures or visual CI of code. This (non-versioned) folder captures the progress of this project.

Details

Changelog

  • pre: cli tool, read from text/csv files and Google Sheets
  • 0.1.0: structure, selector tool
  • 0.2.0: visual update, navbar, make file
  • 0.2.1: jquery, collapsible divs
  • 0.2.2: refactor/symlink random_select_, dynamic table, startup script, reload data via refresh, models.py
  • 0.3.0: read as DataFrames, local csv persistent files (deprecate global variables), refresh to reshuffle data
  • 0.3.1: data options (url), deprecate upload data option
  • 1.0.0: from workflowtools, add dynamic refresh button
  • 1.0.1: published on GitHub, new versioning
  • 1.0.2: add tests, release branch to master

Dev Mode

Set environments and run the following in commandline:

> cd l/_projects/<app_folder>
> source activate lab

In Windows (cmd)

> set FLASK_APP=app.py
> flask run

or Linux (bash)

> export FLASK_APP=app.py
> FLASK_APP=app.py flask run

Use debug mode in a development env to avoid restarting the server:

> set FLASK_ENV=development

The Windows dev commands are automated in the start_flask.bat file.

Tests

Just run:

> nosetests

This should run unit tests and textfixtures.

References