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

Update hello world instructions #1660

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 6 additions & 0 deletions hasher-matcher-actioner/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ def hello_world():
return "Hello, world!\n"
```

If your server is running, stop it by pressing Ctrl+C. Then, start the server and rebuild the image to pick up the changes:

```bash
docker compose up --build
```

Comment on lines +95 to +100
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, this isn't true for the recommended development (dev containers), which will automatically restart without the need for this build.

We can keep a reminder in here if you aren't using dev containers, but it needs to be caveated e.g. by adding a subheader or note, something like:


Let's add the endpoint. In src/OpenMediaMatch/app.py, add a route to the Flask app like so:

@app.route("/hello")
def hello_world():
    return "Hello, world!\n"

Then save the file! If you are using the recommended development environment with a devcontainer, flask will detect a changed file and automatically restart the server, picking up your changes!

If you are not using a devcontainer you might need to stop your server and rebuild the image to pick up changes with docker compose up --build. This is a lot slower than using the devcontainer!

Copy link
Author

Choose a reason for hiding this comment

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

Oh, I see. I first followed the README instructions which said to use docker compose up. Then, found this file and also I don't use VSCode so I skipped that for now. I'll give it a shot today.

Copy link
Contributor

Choose a reason for hiding this comment

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

The CONTRIBUTING is target at developers, and the hello world is the test to see if you have your development environment set up correctly :P

Copy link
Author

Choose a reason for hiding this comment

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

Heh, closing.

Retry the `curl localhost:5000/hello`, you should now see your greeting message come back instead of the 404 error.

## Self-managed Python dev environment
Expand Down
Loading