Giter Site home page Giter Site logo

8-glasses's Introduction

Eight Glasses

A simple app to track how many glasses of water I drink each day, and a project to learn Python for the web.

It should be pretty easy to install on your own machine, if you like. Make a PostgresSQL database with createdb eightglasses; clone the repository; set up a virtual environment and activate it; run pip install -r requirements.txt; then launch with python runserver.py. There's also a Procfile for Heroku, so if you have it, you can use foreman start to run the application via Gunicorn.

You can check out the most recent deployed public app at http://eightglasses.herokuapp.com/. The daily and weekly queries don't work yet, which are pretty core to the functionality desired, so it remains incomplete until that's done.

Aside from that, the to-do list looks something like this:

  • Add support and authentication for multiple user accounts. (Considering following this advice.)
  • Summary tables showing how you've been doing during past days/weeks (or else you can only see your progress for today or this week).
  • Visualize multiple progress metrics, like the area graph in this d3 example.
  • Figure out how to put it on the public web (probably through Heroku). (here)
  • Switch off SQLite to PostgreSQL and SQLAlchemy to abstract database operations.
  • Redo folder structure to use __init__.py along with views.py and models.py instead of one monster file so I'm not writing like a barbarian anymore.
  • Add fun / configurable messages of encouragement for when you do good things.
  • Perhaps enable sharing on social media when you surpass a positive goal.
  • I might make each section into a subtle progress bar. That could be neat.

In general, this has been a really fun application to write. I started with the tutorial for Flask, an open source micro-framework for Python. The html, css, and modals rely on Foundation, (which uses normalize.css and modernizr.js), and colors from clrs.cc.

So far the most frustrating thing was trying to make the application work on Heroku. I had to become a lot more comfortable with the workings of my operating system and my development environment, which is perhaps why I found it to be such a valuable exercise.

That said, it was important to learn the whole range of pieces needed to set up a prototype app. When I wrote the first version a year ago, I had never used Flask, Foundation, SQLAlchemy, or Heroku before, but now I use them and tools like them rather frequently for work and play. I'm looking forward to wrapping up the original set of features so I can call it a day, or decide to plan some more work on it. (I'm thinking about integrating with some of the fitness APIs.)

8-glasses's People

Contributors

michaelsnook avatar

Watchers

James Cloos avatar  avatar

Forkers

musasizifrancis

8-glasses's Issues

Build support for multiple users

Right now, there's just a single user hardcoded into the application. I should really figure out a good (and secure / not-fooling-myself) way to create user accounts. This will probably mean adding a column to every table on the database. ? We will see what I find.

"numbers" page worth looking at

I've got a sortable datatable... now I would like one table grouping the dailies into their respective daily totals, and one grouping the weeklies into theirs, to show how I've been doing over time, and probably a totals sheet showing my all-time totals.

Then charts.

Package Eight Glasses for Heroku deployment

I don't entirely know what it takes to get an app like this onto Heroku, but there seem to be some good resources on the web for getting this set up, including Heroku's own documentation, so I am going to give it a shot.

It's important for the app to be accessible from the web because my primary use case is really for use on my phone, as I'm going throughout my day doing things like drinking water or taking a moment to do a round of situps.

Upgrade from unmanaged SQLite to SQLAlchemy / PostgreSQL

I am pretty comfortable with raw SQL queries, but there are still two reasons I think SQLAlchemy is important.

  1. At some point the project will grow to the point that SQLAlchemy, or some other ORM-like utility, will be helpful, or even needed. (Future-proofing / scalability. Won't be relevant until other issues are resolved, like multiple users and web-accessibility.)
  2. It's a learning opportunity and a good practice, and that's sort of what this app is all about.

However, it's not a good practice to make big changes to central systems without really knowing why you're doing it, so I should really look into some of the other big issues first, like setting up multiple user names (might instruct me on database solutions) and how exactly I'm going to package this app for Heroku (who knows what I will find there, or if I even want to do it this way).

closing alerts

Right now, the alerts with the little x's don't close when you click the x.

I'd also like to see how it looks to make alerts show up in a fixed location (regardless of current vertical scroll / overlaid over your current viewport) and fade away.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.