I wager that Javier already has the best possible answer, but,
nonetheless, I'll try to elaborate it a just a bit more.

When a client requests a resource from your Web server that's handled
by PHP, what happens is that an instance of PHP is fired that
initializes the request data in the globals (like $_POST, $_SERVER)
and sequentially creates a flattened view of your Web application code
necessary to handle that request.

Take PHP MVC frameworks as a good example. All of your requests (like
'/user/evstevemd/') get rewritten to `index.php?r=/user/evstevemd/`.
`index.php` includes a certain `routing.php` that then figures out
that all requests beginning with `/user/` are handled by a controller
that resides somewhere in `users/controllers.php` and so it includes
that, the code there includes something else and so forth until
there's no more code to execute. The fact remains that you also had
several dozens of other PHP files that were never executed, because
that code was never needed to process the particular request that was
received.

Django is a bit different, but that actually has everything do with
the nature of executing Python applications. To process requests that
Django needs to handle, your Web server will actually be communicating
with an instance of a Python interpreter, through the WSGI protocol.
WSGI is just a very small standard that practically says: because
every Web server that accepts HTTP requests has the liberty of
constructing and processing request data to their preferences, this is
the interface that defines how those requests should be passed to a
Python Web application.

Configuring PHP with your Web server is straightforward and it just
works OOTB instantaneously for all your PHP files. Although it's
execution model is simple and popular, if you acknowledge the
drawbacks there's a lot more to benefit from communicating with a long-
running Python process. First off the top is that after initialization
everything is already loaded into the memory, everything is
precomputed for future requests (such as URL routing) and all the
necessary connections to other parts of the system are created, so
subsequent requests become very cheap and are processed "blazingly"
fast.

I'm not an expert on the topic, but if you already have a LAMP stack,
what I'd do is set up nginx as a reverse proxy (approx. 30-ish lines
of code that's hard to get wrong) to your Apache Web server and a WSGI
server. You get the added benefit of not having to recompile/
reconfigure your Apache instance with mod_wsgi (which can easily be
misconfigured) and you can use a Python WSGI server such a Gunicorn or
Spawning that is more Pythonic (i.e. it works and understands Python
code better than mod_wsgi) to handle your Django Web applications.



On Jan 10, 5:17 pm, Thomas <tho...@googlemail.com> wrote:
> Am 10.01.2011 um 16:56 schrieb evstevemd:
>
> > I have LAMPP on Ubuntu and I use it fine with PHP. Now I have to add
> > Django so that I can do PHP and Django projects together. I will have
> > more than one Django project. I have read of mod_wsgi but I cannot
> > understand.
>
> what exactly is the problem?
>
> I found these explanations 
> helpful:http://code.google.com/p/modwsgi/wiki/IntegrationWithDjangohttp://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django...
>
> good luck
>
> > In PHP I just put my project as subdirectory of /var/www/
> > and then access them viahttp://localhost/
> > How do I do with Django?
> > Thanks a lot!
>
> > --
> > 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 
> > athttp://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-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