thismatters / django-mailinglist

Django package for administering outgoing mailing lists to subscribers.
GNU Affero General Public License v3.0
9 stars 1 forks source link

'NotSupportedError: difference is not supported on this database backend' on process_submissions #11

Closed Vincent-Cui closed 6 months ago

Vincent-Cui commented 6 months ago

Hi there,

First off, I'd like to extend my sincere thanks for developing the django-mailinglist package—it's been incredibly helpful in my project. I've encountered an issue, however, and I hope you might be able to provide some guidance or a workaround.

Issue Description: When attempting to send emails using the command python manage.py process_submissions, I encounter the following error: django.db.utils.NotSupportedError: difference is not supported on this database backend. It's worth mentioning that I'm able to receive registration verification emails without any issue, suggesting that my SMTP settings are correctly configured. This leads me to suspect that the problem might be related to the SQL queries being executed.

Environment:

OS: Ubuntu 18.04 Database: MySQL 8.0.28 Django Version: 4 PyMySQL Version: 1.1

Best, Vincent

thismatters commented 6 months ago

Hi Vincent,

Thank you for reporting this. I haven't tested with any database backend other than PostgreSQL and SQLite. I will do so presently and release an update.

(Also, Howdy! I'm an Aggie too)

-paul

thismatters commented 6 months ago

This issue should be resolved in v0.1.7.

Vincent-Cui commented 6 months ago

Howdy, Paul!

Thank you for your prompt reply! Upgrading to version 0.1.7 resolved our issue—what a relief!

I do have a minor follow-up question. Currently, to send out emails, we need to manually execute python manage.py process_submissions from the server's command line. This step requires logging into the server and navigating to the project folder, which is challenging for some team members, particularly those who aren't familiar with command-line interfaces, such as our content writers. As we're a nonprofit organization, this includes several of our volunteers.

Is there a more user-friendly way to handle email dispatch directly from the frontend? Any advice or suggestions you could offer would be greatly appreciated!

By the way, are you still in the BCS area? If so, it would be great to catch up over coffee sometime!

Thanks again, Vincent

thismatters commented 6 months ago

That is a totally reasonable question, logging in to the console is bothersome and potentially dangerous if the person isn't well versed in that environment.

Since sending the messages is potentially a long-running task it cannot be done as part of the typical request-response cycle, thus it cannot be accomplished via an admin button. However, if your stack includes Celery then you should be able to use the built-in celery task for processing submissions. Another alternative would be to configure a cron job on your server to periodically run the process_submissions management command. The autosending section of the documentation goes in to slightly more detail.

Unfortunately I'm not in the BCS area any more, but if you find yourself in Austin let me know!

-paul