This doesn't seem like it should be hard, but I'm stumped. I've gotten django-post_office integrated with my codebase, and now I'm trying to test that I can set up cron jobs for queued email as described in the docs:
https://github.com/ui/django-post_office
Whether I run on the command line or in crontab, I get the same problem:
python manage.py send_queued_mail lockfile='/home/gbeadmin/tmp/post_office.lock'
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/gbeadmin/webapps/gbe2016test/lib/python2.7/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/gbeadmin/webapps/gbe2016test/lib/python2.7/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/gbeadmin/webapps/gbe2016test/lib/python2.7/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/gbeadmin/webapps/gbe2016test/lib/python2.7/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/gbeadmin/.local/lib/python2.7/site-packages/post_office/management/commands/send_queued_mail.py", line 33, in handle
options['lockfile'])
KeyError: 'lockfile'
Digging around, I see that I should be able to specify the lockfile, so I've tried:
python manage.py send_queued_mail --lockfile='<path to lock file>'
Which then gives me the error:
Usage: manage.py send_queued_mail [options]
manage.py: error: no such option: --lockfile
I've also tried the '-L' option listed in the docs, with the same basic result.
I'm lost - I don't see a bug in my syntax, I don't see any other way to set the lock file...
Other notes:
- I'm running in WebFactional
- I'm running django 1.6 (yes, I want to upgrade, that is on the way but can't be in the scope for this ticket)
- django-post_office - 2.0.8
- python 2.7
I'm sorry to hear your problem, but the problem is located in the management command. You see, the KeyError means the 'lockfile' does not exist in the dictionary. Further investigation yields that the root cause of the problem is in the management command. The management command syntax is valid only for Django 1.8 and up. They're currently dropping support for Django < 1.8. Hope this helps !