Coder Social home page Coder Social logo

magiclifts's Introduction

Flask React Project

This is the backend for the Flask React project.

Getting started

  1. Clone this repository (only this branch)

    git clone https://github.com/appacademy-starters/python-project-starter.git
  2. Install dependencies

    pipenv install --dev -r dev-requirements.txt && pipenv install -r requirements.txt
  3. Create a .env file based on the example with proper settings for your development environment

  4. Setup your PostgreSQL user, password and database and make sure it matches your .env file

  5. Get into your pipenv, migrate your database, seed your database, and run your flask app

    pipenv shell
    flask db upgrade
    flask seed all
    flask run
  6. To run the React App in development, checkout the README inside the react-app directory.


IMPORTANT! If you add any python dependencies to your pipfiles, you'll need to regenerate your requirements.txt before deployment. You can do this by running:

pipenv lock -r > requirements.txt

ALSO IMPORTANT! psycopg2-binary MUST remain a dev dependency because you can't install it on apline-linux. There is a layer in the Dockerfile that will install psycopg2 (not binary) for us.


Deploy to Heroku

  1. Create a new project on Heroku

  2. Under Resources click "Find more add-ons" and add the add on called "Heroku Postgres"

  3. Install the Heroku CLI

  4. Run

    heroku login
  5. Login to the heroku container registry

    heroku container:login
  6. Update the REACT_APP_BASE_URL variable in the Dockerfile. This should be the full URL of your Heroku app: i.e. "https://flask-react-aa.herokuapp.com"

  7. Push your docker container to heroku from the root directory of your project. This will build the dockerfile and push the image to your heroku container registry

    heroku container:push web -a {NAME_OF_HEROKU_APP}
  8. Release your docker container to heroku

    heroku container:release web -a {NAME_OF_HEROKU_APP}
  9. set up your database:

    heroku run -a {NAME_OF_HEROKU_APP} flask db upgrade
    heroku run -a {NAME_OF_HEROKU_APP} flask seed all
  10. Under Settings find "Config Vars" and add any additional/secret .env variables.

  11. profit

magiclifts's People

Contributors

lukebraun88 avatar

Stargazers

Quintin Hull avatar Peter Mai avatar Jonathan Wehner avatar Courtney Newcomer avatar Benjamin Lavian avatar

Watchers

 avatar

magiclifts's Issues

As an unauthenticated user I want to be directed to a login/register page so that I can get an account or login to manage a budget.

  • What information does a user need to provide to create an account?: A unique username, a name, a unique email and a valid password. Passwords are obscured and must be confirmed to submit for validation.
  • How is data validated during user sign-ups or logins?: Frontend JavaScript will detect errors that can be handled on the frontend, e.g. email address, name, username and password validations. All form data received from the frontend client will undergo route validation.
  • What happens when a user successfully creates an account?: They are redirected to the main view (lifts).
  • Does a user need to login after they register? NO! They are logged in automatically and then redirected.
  • What are the URLs for logging in and registration?: /login and /sign-up...API routes that handle auth are /api/auth/login and /api/auth/sign-up

As a user I want to be able to see graphs that outline my progress.

  • [ ]How will I see progress on a lift?
    Included are graphs that take the data from your stats and give visual representations for a better idea on what you need to improve.

  • [ ]Can I see graphs based on certain lifts?
    Absolutely! Users can select which lift they would like to see graphs for and the data will be displayed immediately.

  • [ ]What will the graphs be based off of?
    Graphs are based on the stat weight and reps and ordered by date.

### As a user I want to be able to create, edit, and delete lifts.

  • How do I create a new lift?
    There will be a user friendly form available to fill in the title, description, and body part to create lifts.
  • [] How do I edit or delete a lift that I have already created?
    There are 3 dots on the lift box that when clicked, will give you options to edit or delete the lift.

As a user I want to be able to create, edit, and delete stats.

  • How do I create a new stat?
    There will be a user friendly form available to fill in the sets, reps, time, weight, date, difficulty, and any extra notes you want to include to create a new stat.
  • [] How do I edit or delete a stat that I have already created?
    There are 3 dots on the stat box that when clicked, will give you options to edit or delete the lift.

As a user I want to be able to find exercises that will work a certain part of my body.

  • How do i see what exercises to do for certain body parts?
    Users will be given an interactive body diagram that is clickable and will display exercise that will work the part of the body that was clicked.

  • How do I sift through the available exercises to find ones that I like?
    Users will be given multiple exercises pertaining to the clicked body part with descriptions.

As a user who has recently logged in I want to not need to log in every time I navigate to application views and pages so that I can save time and effort while managing my budget.

  • What methods will be employed to accomplish persistent frontend session state?: Session cookie, managed by Flask.
  • How does the application authenticate user claims in the session token?: The frontend can send a GET request to api/auth to authenticate the user, provided the request contains the session token. If the token is valid then the user details of the token are sent back to the frontend client. Otherwise the response will be unauthorized.
  • How often will a user need to re-authenticate themselves? If a session cookie exists and the user accesses an authorized resource then the cookie ought to be "refreshed" at the time of access. From the latest refresh a cookie should exist for no more than 1 hour. At the point of expiration the frontend client should automatically delete the cookie. To prevent use of old cookies to access resources, the session cookie should be assessed for its expiry datetime, which should be encrypted in session cookie.

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.