taylorcornwall766 / weak

0 stars 0 forks source link

Weak log

Weak log is a workout logging and tracking web app. The gym has become a more social place lately. Weak log wants to provide a service where gym goers can track and share their progress in the gym.

Checkout Weak log

Index

MVP Feature List | Database Scheme | User Stories | Wire Frames |

Technologies Used

JavaScriptHTML5CSS3ReactFlaskPythonReduxPostgresNPMGitHub

Landing Page

landing

Exercises

exercisesexercises cont

Home Page (Routines)

home page

Edit Routine and Add Routine Exercises

manage routine

Getting started

  1. Clone this repository Weak Log

  2. Install dependencies in frontend and backend with a terminal for each then run the following:

    In the root of your directory:

      pipenv install -r requirements.txt

    In ./react-app:

      npm install
  3. Create a .env file based on the example with proper settings for your development environment

  4. Make sure the SQLite3 database connection URL is in the .env file

  5. This starter organizes all tables inside the flask_schema schema, defined by the SCHEMA environment variable. Replace the value for SCHEMA with a unique name, making sure you use the snake_case convention.

  6. Get into your pipenv, migrate your database, seed your database, and run your Flask app from your root directory

    pipenv shell
    flask db upgrade
    flask seed all
    flask run
  7. To run the frontend from the ./react-app directory run:

      npm start

Deployment through Render.com

First, refer to your Render.com deployment articles for more detailed instructions about getting started with Render.com, creating a production database, and deployment debugging tips.

From the Dashboard, click on the "New +" button in the navigation bar, and click on "Web Service" to create the application that will be deployed.

Look for the name of the application you want to deploy, and click the "Connect" button to the right of the name.

Now, fill out the form to configure the build and start commands, as well as add the environment variables to properly deploy the application.

Part A: Configure the Start and Build Commands

Start by giving your application a name.

Leave the root directory field blank. By default, Render will run commands from the root directory.

Make sure the Environment field is set set to "Python 3", the Region is set to the location closest to you, and the Branch is set to "main".

Next, add your Build command. This is a script that should include everything that needs to happen before starting the server.

For your Flask project, enter the following command into the Build field, all in one line:

# build command - enter all in one line
npm install --prefix react-app &&
npm run build --prefix react-app &&
pip install -r requirements.txt &&
pip install psycopg2 &&
flask db upgrade &&
flask seed all

This script will install dependencies for the frontend, and run the build command in the package.json file for the frontend, which builds the React application. Then, it will install the dependencies needed for the Python backend, and run the migration and seed files.

Now, add your start command in the Start field:

# start script
gunicorn app:app

If you are using websockets, use the following start command instead for increased performance:

gunicorn --worker-class eventlet -w 1 app:app

Part B: Add the Environment Variables

Click on the "Advanced" button at the bottom of the form to configure the environment variables your application needs to access to run properly. In the development environment, you have been securing these variables in the .env file, which has been removed from source control. In this step, you will need to input the keys and values for the environment variables you need for production into the Render GUI.

Click on "Add Environment Variable" to start adding all of the variables you need for the production environment.

Add the following keys and values in the Render GUI form:

In a new tab, navigate to your dashboard and click on your Postgres database instance.

Add the following keys and values:

Note: Add any other keys and values that may be present in your local .env file. As you work to further develop your project, you may need to add more environment variables to your local .env file. Make sure you add these environment variables to the Render GUI as well for the next deployment.

Next, choose "Yes" for the Auto-Deploy field. This will re-deploy your application every time you push to main.

Now, you are finally ready to deploy! Click "Create Web Service" to deploy your project. The deployment process will likely take about 10-15 minutes if everything works as expected. You can monitor the logs to see your build and start commands being executed, and see any errors in the build process.

When deployment is complete, open your deployed site and check to see if you successfully deployed your Flask application to Render! You can find the URL for your site just below the name of the Web Service at the top of the page.