Sunday, June 20, 2010

Re: A Django project life cycle

If you want to run a piece of code on receiving a view HTTP request,
and a piece of code just before the response is sent to the user, look
into Django middleware
(http://docs.djangoproject.com/en/dev/topics/http/middleware/). That
is what it is specifically designed to do.

If instead you want to run a piece of code when Django starts up, and
when it is killed, that would depend on how you are serving the page.
Are you using Apache? With mod_python, or mod_wsgi?

If you're using mod_wsgi (which you should), the mod_wsgi docs are
quite useful, e.g.
http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

Also, Django's signals functionality might be help too if middleware
is not - http://docs.djangoproject.com/en/dev/ref/signals/#ref-signals

On 20 June 2010 21:24, Sameer Rahmani <lxsameer@gmail.com> wrote:
> i want to run a peace of code in the beginning of life cycle ( may be
> in settings.py ) but i want to know about
> number process and the codes that remain on memory ? olso i want to
> run a peace of code in the ending part
>
> --
> 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.
>
>

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