> I'm trying to figure out the best way to create an automated in a
> python/django web application. My intention is to send an email
> message in the future based on the given future date/time. What is
> the best approach to do this?
>
> I was thinking of creating a cron job and a python script, but I would
> rather have the process be part of my django application so I don't
> have to worry about extra stuff.
If you want to have the active code in Django, you could run a cron to call wget or similar to call a specific URL that does whatever. If you choose to do this, make sure it is locked down - perhaps only execute if REMOTE_HOST is 127.0.0.1.
I generally don't recommend this approach, because it really is mixing distinct functions. What happens if you grow to multiple servers? What happens if you're sending enough mail that you split that off to its own cluster?
Note that it should be straightforward to pull in the Django template classes, if you want to use that for generating your messages.
Also, note that this is precisely what cron is for. Attempting to recreate cron inside of a web application is going to end in tears. Keep your cron job and support scripts in a separate directory in your source repository, and add a checklist for setting it up to your documentation (which is also versioned, right?).
My .02 units of your currency,
-j
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment