Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the code is going to be incompatible between Python 2 and 3, then you should create a separate branch for each of those and remove the master branch. The code I've rewritten should be cross-compatible.

7 changes: 7 additions & 0 deletions Lesson4/step2/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
google_client_id=
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Students should not be storing credentials in JSON files, they should learn the ability to follow the 12 factor app and keep any configuration credentials stored in environment files so each deployment environment has its own configuration settings without having to constantly change between git commits and leave credentials exposed.

google_project_id=
google_client_secret=
facebook_app_id=
facebook_app_secret=
app_secret_key=
debug=
5 changes: 5 additions & 0 deletions Lesson4/step2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.idea/
__pycache__/
pyrepo/
*.pyc
.env
1 change: 1 addition & 0 deletions Lesson4/step2/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.1
39 changes: 39 additions & 0 deletions Lesson4/step2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Restaurants and Menus
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seriously, no readme file? Each directory should have a readme file that explains all of the setup.


The first step is to setup the `.env` file to hold all of the environment variables that are needed to connect to the APIs. To do so, run `cp .env.example .env`, which will copy the example file to the .env file. This file is not committed to the Git repo.

The version of Python is `3.6.1`, which is shown in the `.python-version` file.

After signing up for an app on facebook and google, fill in the values in their appropriate places in the `.env` file. These will automatically cascade to the rest of the app.

The database used by default is restaurantmenuwithusers.db. To change to another database engine, look in the `database_setup.py` file and change the engine to whatever is appropriate for your use case.

To start using the program, run:
```shell
pip install -r requirements.txt
```

This will install all of the dependencies.

To re-run the base seeds, run `python lotsofmenus.py`.

To start up the app, run either:

```shell
export FLASK_APP=project.py
flask run
```

Or
```shell
python project.py
```

All dependencies are kept in the .env file. To create the .env file, run

```shell
cp .env.example .env
```

Then fill in the environment values with their required settings.

1 change: 0 additions & 1 deletion Lesson4/step2/client_secrets.json

This file was deleted.

5 changes: 3 additions & 2 deletions Lesson4/step2/database_setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#! /usr/bin/env python3

from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine

Base = declarative_base()

Expand Down Expand Up @@ -59,5 +61,4 @@ def serialize(self):

engine = create_engine('sqlite:///restaurantmenuwithusers.db')


Base.metadata.create_all(engine)
6 changes: 0 additions & 6 deletions Lesson4/step2/fb_client_secrets.json

This file was deleted.

Loading