This project uses Django 2.2 that requires Python 3
- Install Python:
brew install python
- Create virtual environment
python -m venv .venv
- Activate virtual environment
source .venv/bin/activate
- Install Sentry's command line tool to use release tracking and Github integration for commit data:
python -m pip install "sentry-cli"
The Sentry client library requires a DSN generated from Sentry which specifies the project events will be sent to. Add the import and configuration code to settings.py
:
import sentry_sdk
sentry_sdk.init(
dsn="https://yourdsn@sentry.io/1234567"
)
Further details on configuring Sentry here.
Run deploy
target in Makefile
. This will install relevant python libraries and run Django server.
make deploy
This demo uses Django's rest-framework package and offers 3 API endpoints:
- http://localhost:8000/handled - generates a runtime error explicitly reported to Sentry though the SDK's
captureException
- http://localhost:8000/unhandled - generates an unhandled runtime error reported
- http://localhost:8000/checkout - can be used with the Sentry REACT demo store front demo This endpoint can also be used with directly through the Django REST Framework web UI. To generate an error paste the following JSON payload in the POST payload text area:
{
"cart": [
{"id": "wrench", "name": "Wrench", "price": 500},
{"id": "wrench", "name": "Wrench", "price": 500}
],
"email": "user@email.com"
}
Pressing Ctrl-C once in each terminal window should stop Django's development server.
To deactivate the virtual environment:
deactivate
To remove the virtual environment:
rm -rf .venv/