Skip to content
Permalink
Browse files

Update database setup instructions

  • Loading branch information...
nlaz committed Apr 16, 2019
1 parent 7eaa27f commit eb70e0bbae4dc82377fc78ddbbd0416ac8fa4dd9
Showing with 25 additions and 5 deletions.
  1. +12 −2 README.md
  2. +13 −3 docs/USER_GUIDE.md
@@ -50,7 +50,17 @@ https://localhost:5000/auth/callback/github

The default port for Flask apps is `5000`, but you may need to update this if your setup uses a different port or if you're hosting your app somewhere besides your local machine.

**Step 4: Update environment variables and run the Server.**
**Step 4: Setup your database**

You need to be able to connect to a database either on your own computer (locally) or through a hosted database. You can [install Postgres locally](http://www.postgresqltutorial.com/install-postgresql/) and [connect to it](http://www.postgresqltutorial.com/connect-to-postgresql-database/) to provide the database for your app.

You will need to know the connection URL for your application which we will call `DATABASE_URL` in your environment variables. Here is an example:

```
postgresql://localhost:5432/mlh-hackathon-starter-flask
```

**Step 5: Update environment variables and run the Server.**

Create a new file named `.env` by duplicating `.env.example`. Update the new file with the GitHub credentials. It should look similar to this:

@@ -61,7 +71,7 @@ GITHUB_CLIENT_ID="[INSERT_CLIENT_ID]"
GITHUB_CLIENT_SECRET="[INSERT_CLIENT_SECRET]"
```

You replace the GitHub credentials here and update the database URL. Learn more about the required [Environment Variables here](#environment-variables).
You replace the GitHub credentials here and update the database URL. Learn more about the required [Environment Variables here](https://github.com/MLH/mlh-hackathon-flask-starter/blob/master/docs/USER_GUIDE.md#environment-variables).

Now we're ready to start our server which is as simple as:

@@ -44,7 +44,17 @@ https://localhost:5000/auth/callback/github

The default port for Flask apps is `5000`, but you may need to update this if your setup uses a different port or if you're hosting your app somewhere besides your local machine.

**Step 4: Update environment variables and run the Server.**
**Step 4: Setup your database**

You need to be able to connect to a database either on your own computer (locally) or through a hosted database. You can [install Postgres locally](http://www.postgresqltutorial.com/install-postgresql/) and [connect to it](http://www.postgresqltutorial.com/connect-to-postgresql-database/) to provide the database for your app.

You will need to know the connection URL for your application which we will call `DATABASE_URL` in your environment variables. Here is an example:

```
postgresql://localhost:5432/mlh-hackathon-starter-flask
```

**Step 5: Update environment variables and run the Server.**

Create a new file named `.env` by duplicating `.env.sample`. Update the new file with the GitHub credentials. It should look similar to this:

@@ -172,9 +182,9 @@ The `style.css` file is a good place to add custom CSS. Add any of your CSS or J

Flask does not come with a database layer by default. It is designed to have a database added later. You can add your own preferred database type to the project if needed. We like the PostgreSQL database which is easy to deploy with Heroku.

To use PostgreSQL with your project, you will need to [install it locally](https://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.4).
To use PostgreSQL with your project, you will need to [install it locally](http://www.postgresqltutorial.com/install-postgresql/).

1. Install [Postgres locally](https://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.4)\*
1. Install [Postgres locally](http://www.postgresqltutorial.com/install-postgresql/)\*
2. Make sure Postgres is running locally.
3. Replace the `DATABASE_URL` variable in `.env` with your database.
- i.e. `DATABASE_URL=postgresql://localhost:5432/mlh-hackathon-flask-starter`

0 comments on commit eb70e0b

Please sign in to comment.
You can’t perform that action at this time.