views:

390

answers:

3

I want to use django-mailer without PINAX. When I run ./manager.py send_mail it prints:

Unknown command: 'send_mail'
Type 'manage.py help' for usage.

How do I fix this?

Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31) 
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> 'mailer' in settings.INSTALLED_APPS
True
>>> 

$./manage.py send_mail
Unknown command: 'send_mail'
Type 'manage.py help' for usage.

and I used easy_install django-mailer to install the mailer, and the django version is

    VERSION = (1, 1, 1, 'final', 0)

and mailer version is 0.1.0

+2  A: 

Can't you just download it from django-mailer and install it separately?

Dominic Rodger
A: 

Have you installed it and added it to your INSTALLED_APPS setting?

jcdyer
+1  A: 

A few things to double check:

  1. Did you install django-mailer?
  2. Is mailer in your PYTHONPATH? When you import mailer, are you getting the expected module (version and expected path)?
  3. Is mailer listed in your INSTALLED_APPS?
$ ./manage.py shell
>>> import mailer
>>> mailer.get_version()
'0.1.0'
>>> mailer.__file__
/PATH/TO/YOUR/PYTHON/LIBS/mailer/__init__.py
>>> # did it import?  did you get the expected version?  expected path?  
>>> # good, django-mailer is in your PYTHONPATH.  now verify project settings.
>>> from django.conf import settings
>>> 'mailer' in settings.INSTALLED_APPS
True

At this point you should see send_mail in the list of available manage.py subcommands.

$ ./manage.py --help
Usage: manage.py subcommand [options] [args]
[...]
runserver
send_mail
shell
[...]
$

After than you will also want to make sure that you are running ./manage.py send_mail via a cron job.

* * * * * (cd $YOUR_PROJECT; /usr/bin/python manage.py send_mail >> cron_mail.log 2>&1)  
0,20,40 * * * * (cd $YOUR_PROJECT; /usr/bin/python manage.py retry_deferred >> cron_mail_deferred.log 2>&1)

There is no need to actually set these two cronjobs up during development, just look for your messages via the admin.

The django-mailer module has usage instructions but this should get you up and running.

istruble
Added a check to make sure the project can import mailer. The question was updated to confirm that django-mailer was installed via easy_install but the "Unknown command" error suggests that mailer might not be available via the current PYTHONPATH environment setting.
istruble