Friday, June 24, 2011

Re: New to Django

On Fri, Jun 24, 2011 at 3:52 PM, sony <psuedopoda@gmail.com> wrote:
> I need to call this file and the output given by it has to be inserted
> into a database table which I have already created using the models.py
> file.

when do you want this to be called? on response by a web request? at
a certain hour every day? every 30 minutes?

do you already have an app to handle the data? i guess so, because you
already have the models; but do you also have the
views/templates/admin ?

the exact location of the file isn't too important; if it's tightly
tied to the web app, i just put in the app directory. if it's more
like an external module, put it somewhere in the PYTHON_PATH.

the important part is where to call this file's functionality. if by
a web request, do it in a view. if by a time clock, create an
administrator command
(https://docs.djangoproject.com/en/1.3/howto/custom-management-commands/)
and set a cronjob to execute it. if by a web request, but the result
won't be ready in a few milliseconds, use a queue manager to send the
command from a view to a daemon (the most recommended is celery, but
there are others).

--
Javier

--
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