Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes numerous issues, read the body. #52

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
28 changes: 28 additions & 0 deletions Lesson4/step2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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.

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
```
1 change: 0 additions & 1 deletion Lesson4/step2/client_secrets.json

This file was deleted.

3 changes: 1 addition & 2 deletions Lesson4/step2/database_setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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 +59,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.

145 changes: 82 additions & 63 deletions Lesson4/step2/lotsofmenus.py

Large diffs are not rendered by default.

Loading