examples/django/README.md
This example demonstrates how you can use Bolt for Python in your Django application. The project consists of two apps.
simple_app - Single-workspace App ExampleIf you want to run a simple app like the one you've tried in the Building an App guide, this is the right one for you. By default, this Django project runs this application. If you want to switch to OAuth flow supported one, modify myslackapp/urls.py.
To run this app, all you need to do are:
app_mentions:read, chat:write in Scopes > Bot Token Scopesxoxb-You can start your Django application this way:
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
export SLACK_SIGNING_SECRET=(You can find this value at Settings > Basic Information > App Credentials > Signing Secret)
export SLACK_BOT_TOKEN=(You can find this value at Settings > Install App > Bot User OAuth Token)
python manage.py migrate
python manage.py runserver 0.0.0.0:3000
As you did at Building an App guide, configure ngrok or something similar to serve a public endpoint. Lastly,
https://{your public domain}/slack/eventsoauth_app - Multiple-workspace App Example (OAuth flow supported)By default, this Django project runs this application. If you want to switch to OAuth flow supported one, modify myslackapp/urls.py.
This example uses SQLite. If you are looking for an example using MySQL, check the mysql-docker-compose.yml and the comment in myslackapp/settings.py.
To run this app, all you need to do are:
app_mentions:read, chat:write in Scopes > Bot Token ScopesYou can start your Django application this way:
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
export SLACK_SIGNING_SECRET=(You can find this value at Settings > Basic Information > App Credentials > Signing Secret)
export SLACK_CLIENT_ID=(You can find this value at Settings > Basic Information > App Credentials > Client ID)
export SLACK_CLIENT_SECRET=(You can find this value at Settings > Basic Information > App Credentials > Client Secret)
export SLACK_SCOPES=app_mentions:read,chat:write
python manage.py migrate
python manage.py runserver 0.0.0.0:3000
As you did at Building an App guide, configure ngrok or something similar to serve a public endpoint. Lastly,
https://{your public domain}/slack/eventshttps://{your public domain}/slack/install and complete the installation flowhttps://{your public domain}/slack/oauth_redirect as your redirect URL for your app in Oauth & Permissions on the Slack app configuration page.