Skip to content

Commit

Permalink
Add flask-cors update README, this fixes #6 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwi2 authored Jul 28, 2019
1 parent 1775f33 commit c257e23
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,27 @@

### Run Development Server

- Create and activate environment
```
- Create environment (This is only needed for the first time)

```sh
python3 -m venv venv
. venv/bin/activate
```

- Install Flask locally (if you haven't)
- Activate environment

```sh
. venv/bin/activate
```
pip install Flask

- Install Flask and other dependencies locally (if you haven't)

```sh
pip install -r requirements.txt
```

- Run
```

```sh
env FLASK_APP=main.py flask run
```

Expand All @@ -33,4 +41,3 @@ Before deploy to gcloud, you have to install gcloud sdk. ([Install guide](https:
```
gcloud deploy
```

2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from flask import Flask
from flask import jsonify
from flask_cors import CORS

# test data
dummy0 = {
Expand Down Expand Up @@ -53,6 +54,7 @@
photos = [dummy0, dummy1, dummy2]

app = Flask(__name__)
CORS(app)
app.config["JSON_AS_ASCII"] = False

@app.route('/')
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Flask==0.12.3
Flask>=1.0.0
flask-cors>=3.0.8
gunicorn==19.7.1

0 comments on commit c257e23

Please sign in to comment.