Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Incorporated Anthony's comments from his review
  • Loading branch information
rachel-lawrie committed Sep 5, 2024
1 parent 606ce92 commit 5d2a175
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,7 @@ make install

### 4. Start a server on localhost to see your changes

In api.py, comment out
```
CORS(app)
```

Add
```
CORS(app, resources={r"/*": {"origins": "*"}})
```

Then run:
Run:

```
make debug
Expand All @@ -60,6 +50,18 @@ debug:
FLASK_APP=policyengine_api.api FLASK_DEBUG=1 flask run --without-threads --port=5001
```

If you get a CORS error try:

In api.py, comment out
```
CORS(app)
```

Add
```
CORS(app, resources={r"/*": {"origins": "*"}})
```

A simple API get call you can send in Postman to make sure it is working as expected is:
```
http://127.0.0.1:5001/us/policy/2
Expand All @@ -82,7 +84,7 @@ NOTE: Any output that needs to be calculated will not work. Therefore, only hous

### 6. Testing calculations

To test anything that utilizes Redis or the API's service workers (e.g. anything that requires calculations), you'll also need to complete the following steps:
To test anything that utilizes Redis or the API's service workers (e.g. anything that requires society-wide calculations with the policy calculator), you'll also need to complete the following steps:

1. Start Redis
- Install Redis:
Expand Down Expand Up @@ -113,7 +115,7 @@ gcloud auth application-default login

Return to policyengine-api folder and relevant python environment and run:
```
POLICYENGINE_DB_PASSWORD="" python policyengine_api/worker.py
POLICYENGINE_DB_PASSWORD="PASSWORD_HERE" python policyengine_api/worker.py
```

NOTE: Calculations are not possible in the uk app without access to a specific dataset. Expect an error: "ValueError: Invalid response code 404 for url https://api.github.com/repos/policyengine/non-public-microdata/releases/tags/uk-2024-march-efo."
Expand Down

0 comments on commit 5d2a175

Please sign in to comment.