Also, one way to integrate scripts like this is to write them as
django management commands, so you can run them as 'python manage.py
yourcommand'. Management commands are pretty well documented in the
django docs, you should have no trouble finding enough info to get
started.


Again, good luck

Chris Lawlor

On Oct 4, 3:29 am, Martin Melin <mme...@gmail.com> wrote:
> On Mon, Oct 4, 2010 at 8:25 AM, mark jason <markjaso...@gmail.com> wrote:
> > hi
> > I am quite new to django ..I  have written a web app that takes user
> > input  and adds  customer details to db.
> > I store customer name,email ,a datetime value for each customer.
>
> > When the application starts ,I want a utility program to check the db
> > and if system datetime matches the datetime value stored for each
> > customer, an email is sent to the customer.
>
> > My doubt is ,where and how should I put the db checking and email
> > sending event logic.Should it be when the webserver starts(at python
> > manage.py runserver) ?If so ,where do I put the call to
> > check_db(),send_email() etc
>
> > I know it is a silly one,but please understand that I am a newcomer to
> > django and python..and programming in general
>
> > thanks and hoping for guidance
> > mark
>
> I assume the functionality you're after is that a specific user should
> receive an email as close to the datetime in their profile as
> possible?
>
> In that case, you don't want to run this only at application start.
> Generally it is not recommended to do anything at start, because
> depending on your environment it can be kind of undefined when
> "application start" actually occurs. "python manage.py runserver" is
> the so-called development server, and you should not rely on using it
> in production (when the app is on a server, not your local computer)
>
> A common way to solve problems like the one you're describing is to
> have a standalone script that runs periodically, triggered by cron.
>
> For info on writing scripts that have access to your Django project's
> models etc., have a look at Google's results for "django crontab" or
> similar.
>
> Good luck!
>
> Best regards,
> Martin Melin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to