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

slack_message fails silently #115

Open
lexer21 opened this issue Jan 10, 2023 · 2 comments
Open

slack_message fails silently #115

lexer21 opened this issue Jan 10, 2023 · 2 comments

Comments

@lexer21
Copy link

lexer21 commented Jan 10, 2023

Hello im trying to send a test message on my local machine to my slack channel but it fails silently.
I'm trying to run the following function send_msg in django shell but it fails silently. I have gotten a slack bot token setup, i have invited my bot to my #general channel. django_slack was added to INSTALLED_APPS.

I'm using:

  • Django 4.0.3
  • django-slack 5.18.0
from django_slack import slack_message

def send_msg():
    slack_message('test/message.slack', {
        'foo': "test"
    })

Here is imy message.slack template.

{% extends django_slack %}

{% block text %}
Message text here: {{ foo }}
{% endblock %}

My settings for TEMPLATES

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [os.path.join(BASE_DIR, "templates")],
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
            "loaders": [
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader'
            ]
        },
    },
]

Also i have noticed if I set SLACK_TOKEN to some invalid value, I dont get any error, it also fails silently.

@serdarjan1995
Copy link
Contributor

I have run into similar issue. In fact it was related with DEBUG=True,
As described here https://django-slack.readthedocs.io/#slack-backend we need to manually set SLACK_BACKEND in settings.py

@lamby
Copy link
Owner

lamby commented Mar 1, 2023

As in, it was incorrectly using the DisabledBackend...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants