Re: Understanding the use of Apache and nginix with Django

2012-09-08 Thread Javier Guerra Giraldez
On Sat, Sep 8, 2012 at 9:49 AM, Reginald Choudari
 wrote:
> Django doesn't serve files itself; it leaves that job to whichever Web
> server you choose.
> We recommend using a separate Web server -- i.e., one that's not also
> running Django -- for serving media. Here are some good choices:

some time ago, the recommended Apache module was mod_python, which ran
Python code in the same process as the media serving capabilities of
Apache.  that led to suboptimal use of RAM

the advice was, and still is, to use different processes for media and
app code, therefore a separate webserver was a good advise if you used
mod_python.

now, mod_python is deprecated, and mod_wsgi manages a separate process
for Django.  uwsgi does a similar thing.  so, it's quite easy to do a
very good architecture with just Apache and mod_wsgi, or just nginx
and uwsgi.  (there are still many other options, of course)

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Understanding the use of Apache and nginix with Django

2012-09-08 Thread Psamathos
If you are using only Apache with mod_wsgi, you will also need to set up 
Aliases for your media directories (like css, images, or user-uploaded 
files). This is because mod_wsgi doesn't serve static files, it is only 
used to generate the dynamic pages of your site. It's perfectly possible to 
use Apache alone to do this without employing another web server. However, 
if you are implementing a site that you expect will receive high load you 
may want to set up a separate web server to act as a reverse proxy to your 
apache/mod_wsgi server while also serving static files. This will allow you 
to use nginx to serve static files independently of apache, for which nginx 
is technically more efficient although in my opinion the actual difference 
in negligible. I would personally stick with an apache-only configuration 
unless you need the flexibility afforded by two separate web server 
configurations. 

If you're using Django 1.4 you should be using the built-in staticfiles 
app: https://docs.djangoproject.com/en/1.4/howto/static-files/

On Saturday, 8 September 2012 10:49:26 UTC-4, Reginald Choudari wrote:
>
> Hello,
>
> I've just started working on deploying a Django hosted website on my VPS. 
> Last night I finished configuring mod_wsgi with apache2.2 and had got the 
> 'It works!' page running from my Django project. I read here (
> https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/) the 
> following: 
>
> Django doesn't serve files itself; it leaves that job to whichever Web 
> server you choose.
> We recommend using a separate Web server -- i.e., one that's not also 
> running Django -- for serving media. Here are some good choices:
>
>- lighttpd 
>
>
>- Nginx 
>
> I don't really understand this. This morning I configured my urls.py and 
> views.py to direct the '/' site url to an index.html template I created on 
> the fly (just for sanity check). Although it wasn't working at first, I 
> restarted apache2.2 service and the web page shows fine now. I don't 
> understand the idea of hosting two web servers and how Django is involved 
> with this if at all. 
>
> To me, it seems like apache routes clients to the wsgi, and the wsgi 
> returns with whatever http response it conjures up? Can someone shed some 
> light on this?
>
> Thanks,
> RC
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9XWD6jFXeRAJ.
To post to this group, send email to django-users@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.



Re: Understanding the use of Apache and nginix with Django

2012-09-08 Thread Phang Mulianto
Hi,

The apache or whatever the webserver you choose, should only serving static
files, not .py files .

the / request to your webserver will be redirect to django process, whether
it is uwsgi, or wsgi , or whatever service you choose to deploy.

Django runs as application server actually.

user -- web server   application server --- db server

hope helps

rgds,
Mulianto

On Sat, Sep 8, 2012 at 10:49 PM, Reginald Choudari <
adnanchowdhur...@gmail.com> wrote:

> Hello,
>
> I've just started working on deploying a Django hosted website on my VPS.
> Last night I finished configuring mod_wsgi with apache2.2 and had got the
> 'It works!' page running from my Django project. I read here (
> https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/) the
> following:
>
> Django doesn't serve files itself; it leaves that job to whichever Web
> server you choose.
> We recommend using a separate Web server -- i.e., one that's not also
> running Django -- for serving media. Here are some good choices:
>
>- lighttpd 
>
>
>- Nginx 
>
> I don't really understand this. This morning I configured my urls.py and
> views.py to direct the '/' site url to an index.html template I created on
> the fly (just for sanity check). Although it wasn't working at first, I
> restarted apache2.2 service and the web page shows fine now. I don't
> understand the idea of hosting two web servers and how Django is involved
> with this if at all.
>
> To me, it seems like apache routes clients to the wsgi, and the wsgi
> returns with whatever http response it conjures up? Can someone shed some
> light on this?
>
> Thanks,
> RC
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/9KrPNlJvEbwJ.
> To post to this group, send email to django-users@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.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Understanding the use of Apache and nginix with Django

2012-09-08 Thread Reginald Choudari
Hello,

I've just started working on deploying a Django hosted website on my VPS. 
Last night I finished configuring mod_wsgi with apache2.2 and had got the 
'It works!' page running from my Django project. I read here (
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/) the 
following: 

Django doesn't serve files itself; it leaves that job to whichever Web 
server you choose.
We recommend using a separate Web server -- i.e., one that's not also 
running Django -- for serving media. Here are some good choices:
   
   - lighttpd 


   - Nginx 

I don't really understand this. This morning I configured my urls.py and 
views.py to direct the '/' site url to an index.html template I created on 
the fly (just for sanity check). Although it wasn't working at first, I 
restarted apache2.2 service and the web page shows fine now. I don't 
understand the idea of hosting two web servers and how Django is involved 
with this if at all. 

To me, it seems like apache routes clients to the wsgi, and the wsgi 
returns with whatever http response it conjures up? Can someone shed some 
light on this?

Thanks,
RC

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9KrPNlJvEbwJ.
To post to this group, send email to django-users@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.