Add celery task for get_email

Allows you to get_email even without cron, thus enabling the use of django-helpdesk of cronless PaaS services.
This commit is contained in:
Timothy Hobbs 2018-11-07 15:01:41 +01:00
parent 09d8f8c488
commit e96f1559e7
No known key found for this signature in database
GPG Key ID: 9CA9B3D779CEEDE7
4 changed files with 22 additions and 6 deletions

View File

@ -9,7 +9,7 @@ Before django-helpdesk will be much use, you need to do some basic configuration
2. Visit ``http://yoursite/helpdesk/`` (or whatever path as defined in your ``urls.py``)
3. If you wish to automatically create tickets from the contents of an e-mail inbox, set up a cronjob to run the management command on a regular basis.
3. If you wish to automatically create tickets from the contents of an e-mail inbox, set up a cronjob to run the management command on a regular basis. (Or use Celery, see below)
Don't forget to set the relevant Django environment variables in your crontab::
@ -19,6 +19,8 @@ Before django-helpdesk will be much use, you need to do some basic configuration
**IMPORTANT NOTE**: Any tickets created via POP3 or IMAP mailboxes will DELETE the original e-mail from the mail server.
If you wish to use `celery` instead of cron, you must add 'django_celery_beat' to `INSTALLED_APPS` and add a periodic celery task through the Django admin.
4. If you wish to automatically escalate tickets based on their age, set up a cronjob to run the escalation command on a regular basis::
0 * * * * /path/to/helpdesksite/manage.py escalate_tickets

8
helpdesk/tasks.py Normal file
View File

@ -0,0 +1,8 @@
from celery import task
from .email import process_email
@task()
def helpdesk_process_email():
process_email()

View File

@ -15,6 +15,10 @@ from django.views.generic import TemplateView
from helpdesk.decorators import helpdesk_staff_member_required, protect_view
from helpdesk import settings as helpdesk_settings
from helpdesk.views import feeds, staff, public, kb
try:
import helpdesk.tasks
except ImportError:
pass
class DirectTemplateView(TemplateView):

View File

@ -1,5 +1,7 @@
Django>=1.11,<3
django-bootstrap-form>=3.3,<4
celery
django-celery-beat
email-reply-parser
django-markdown-deux
beautifulsoup4