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

feat(flask): Add example to trigger an error #1011

Merged
merged 1 commit into from
May 24, 2019
Merged
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
37 changes: 23 additions & 14 deletions src/collections/_documentation/platforms/python/flask.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,35 @@ sidebar_order: 2
The Flask integration adds support for the [Flask Web
Framework](http://flask.pocoo.org/).

1. Install `sentry-sdk` from PyPI with the `flask` extra:
Install `sentry-sdk` from PyPI with the `flask` extra:

```bash
$ pip install --upgrade 'sentry-sdk[flask]=={% sdk_version sentry.python %}'
```
```bash
$ pip install --upgrade 'sentry-sdk[flask]=={% sdk_version sentry.python %}'
```

2. To configure the SDK, initialize it with the integration before or after your app has been initialized:
To configure the SDK, initialize it with the integration before or after your app has been initialized:

```python
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
```python
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
integrations=[FlaskIntegration()]
)
sentry_sdk.init(
dsn="___PUBLIC_DSN___",
integrations=[FlaskIntegration()]
)

app = Flask(__name__)
```
app = Flask(__name__)
```

You can easily verify your Sentry installation by creating a route that triggers an error:

```py
@app.route('/debug-sentry')
def hello_world():
division_by_zero = 1 / 0
```

Visiting this route will trigger an error that will be captured by Sentry.
<!-- ENDWIZARD -->

## Behavior
Expand Down