On Aug 9, 2006, at 8:56 AM, Joe wrote:
>
> I would like to set up a python script that runs every night to send
> out an email subscription. I would like to access a Django model that
> has the user's email addresses, as well as use the Django sendmail
> function. Can someone help me understand what imports/path setup I
> have to do to get this working? (Note: I will not be setting up the
> Cron job, nor do I know now. I will simply be giving a python script
> to our IT staff for them to set up).
Here's what I use:
------
import sys, os
sys.path.append('/home/ohgoditb/django_projects')
sys.path.append('/home/ohgoditb/django_src/django/bin')
sys.path.append('/home/ohgoditb/django_src')
sys.path.append('/home/ohgoditb/python_libs/lib/python2.3/site-
packages')
sys.path.append('/home/ohgoditb/python_libs/bin/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'fallingbullets.settings'
from fallingbullets.apps.links import models
models.sync_magnolia_links()
from fallingbullets.apps.photos import models
models.sync_flickr_photos()
-------
Then just call "python that_file.py" from the cron job.
I think some of my paths in my $PATH are redundant and you'll notice
my fun little namespace collision with 'models', but it works well
enough for me. 'fallingbullets' is the name of the project.
Regards,
Tyson
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---