/wineaux

An Untappd clone for wine

Primary LanguagePython

Wineaux

Wineaux is an app that takes inspiration from untappd for users to share their impressions of various wines and browse the reviews of other users.

Technologies Used

Welcome to Wineaux

Share, Discover, & Review New Wines !

Screen Shot 2022-06-03 at 4 36 16 PM

View Wine Profiles

Get detailed information & a list of reviews on any wine you find here on Wineaux !

Screen Shot 2022-06-03 at 4 37 06 PM

Leave Reviews on Wines

Leave a custom detailed review on any wine. You can also include an image !

Screen Shot 2022-06-03 at 4 37 38 PM

Custom Profile Pages

Customize your profile & share your reviews / discoveries !

Screen Shot 2022-06-03 at 4 38 01 PM

About us

Get to know the developers who helped make Wineaux come to life !

Screen Shot 2022-06-03 at 4 38 29 PM

Getting started

  1. Clone this repository (only this branch)

    git clone https://github.com/samuelrkramer/wineaux.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! psycopg2-binary MUST remain a dev dependency because you can't install it on alpine-linux. There is a layer in the Dockerfile that will install psycopg2 (not binary) for us.


Dev Containers (OPTIONAL for M1 Users)

The following instructions detail an optional development setup for M1 Mac users having issues with the psycopg package.

  1. Make sure you have the Microsoft Remote - Containers extension installed.

  2. Make sure you have Docker installed on your computer.

  3. Clone the repository (only this branch)

    git clone https://github.com/appacademy-starters/python-project-starter.git
  4. Open the repo in VS Code.

  5. Click "Open in Container" when VS Code prompts to open container in the bottom right hand corner.

  6. Be Patient! The initial install will take a LONG time, it's building a container that has postgres preconfigured and even installing all your project dependencies. (For both flask and react!)

    Note: This will take much less time on future starts because everything will be cached.

  7. Once everything is up, be sure to make a .env file based on .env.example in both the root directory and the react-app directory before running your app. You do not need a DATABASE_URL in the .env file if you are using this Docker setup for development - the URL is already set in the image (see .devcontainer/Dockerfile for the URL).

  8. 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
  9. To run the React App in development, checkout the README inside the react-app directory.


Deploy to Heroku

This repo comes configured with Github Actions. When you push to your main branch, Github will automatically pull your code, package and push it to Heroku, and then release the new image and run db migrations.

  1. Write your Dockerfile. In order for the Github action to work effectively, it must have a configured Dockerfile. Follow the comments found in this Dockerfile to write your own!

  2. Create a new project on Heroku.

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

  4. Configure production environment variables. In your Heroku app settings -> config variables you should have two environment variables set:

    Key Value
    DATABASE_URL Autogenerated when adding postgres to Heroku app
    SECRET_KEY Random string full of entropy
  5. Generate a Heroku OAuth token for your Github Action. To do so, log in to Heroku via your command line with heroku login. Once you are logged in, run heroku authorizations:create. Copy the GUID value for the Token key.

  6. In your Github Actions Secrets you should have two environment variables set. You can set these variables via your Github repository settings -> secrets -> actions. Click "New respository secret" to create each of the following variables:

    Key Value
    HEROKU_API_KEY Heroku Oauth Token (from step 6)
    HEROKU_APP_NAME Heroku app name
  7. Push to your main branch! This will trigger the Github Action to build your Docker image and deploy your application to the Heroku container registry. Please note that the Github Action will automatically upgrade your production database with flask db upgrade. However, it will not automatically seed your database. You must manually seed your production database if/when you so choose (see step 8).

  8. Attention! Please run this command only if you wish to seed your production database: heroku run -a HEROKU_APP_NAME flask seed all