Django, Apache, MySQL on Windows in Production

109 views
Skip to first unread message

Dimitry Zolotaryov

unread,
Jul 26, 2011, 1:53:45 PM7/26/11
to Django users
Hi all,

I was wandering if you could tell me what to look out for when
installing Django with Apache on a Windows Server 2008 machine. Is
there anything I should be aware of in terms of installation problems,
performance issues or compatibility with some general purpose
libraries?

Thanks

Dimitry

PS Win 2k8 is a requirement; I have no choice in the matter. But
choosing Apache over IIS is an option.

Andre Terra

unread,
Jul 26, 2011, 2:23:54 PM7/26/11
to django...@googlegroups.com
Hello, Dimitry

You can take a look at using something like nginx for serving small static files, which can otherwise keep Apache busy and therefore delay its response for more important tasks.

At the risk of flaming, I should note that I have never heard of anything that MySQL does better than PostgreSQL. Most of the users I've encountered use it because it's the devil they know, but eventually it has quite a few shortcomings that can be quite annoying in some cases.


Cheers,
AT


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


Javier Guerra Giraldez

unread,
Jul 26, 2011, 3:03:31 PM7/26/11
to django...@googlegroups.com
On Tue, Jul 26, 2011 at 9:23 AM, Andre Terra <andre...@gmail.com> wrote:
> You can take a look at using something like nginx for serving small static
> files, which can otherwise keep Apache busy and therefore delay its response
> for more important tasks.
>
> At the risk of flaming, I should note that I have never heard of anything
> that MySQL does better than PostgreSQL. Most of the users I've encountered
> use it because it's the devil they know, but eventually it has quite a few
> shortcomings that can be quite annoying in some cases.

while it's true that the most used tools aren't always the best,
there's also the issue of not introducing too much unknown variables,
especially when you're not really experienced on all of them.

In this case, Dimitry needs to use a less-supported OS; i'd advise to
stay with what's known to work well.

IOW: how's nginx and PostgreSQL support on windows?

--
Javier

Dimitry Zolotaryov

unread,
Jul 26, 2011, 4:33:59 PM7/26/11
to Django users
Javier,

You're correct in assuming that these are the tools I'm most
comfortable with.

Knowing this, any advice on the original question would be greatly
appreciated.

Thanks.

Dimitry

On Jul 26, 11:03 am, Javier Guerra Giraldez <jav...@guerrag.com>
wrote:

Javier Guerra Giraldez

unread,
Jul 26, 2011, 5:03:08 PM7/26/11
to django...@googlegroups.com
On Tue, Jul 26, 2011 at 11:33 AM, Dimitry Zolotaryov <dim...@webit.ca> wrote:
> Knowing this, any advice on the original question would be greatly
> appreciated.

I haven't done any deployment on windows; but i do know some helpful facts:

- microsoft invests a lot of money in making sure that high-profile
OSS projects do run and run well on windows. That definitely includes
Apache, Python, and MySQL at least. don't know if PostgreSQL enjoys
this treatment (might erode into MS-SQL server mindshare?)

- nginx and mod_wsgi can be compiled, and kinda run; but with severe
limitations. mod_wsgi in particular can't run in daemon mode.

- any pure-Python setting should run without surprises, that lets you
choose either gunicorn or flup (for FastCGI) behind Apache. contrary
to some comments, a well-supervised flup setup can perform just as
good as the cool guys; but if you're not familiar with it gunicorn
might be easier. again, it's more a question of familiarity than of
performance.


good luck!

--
Javier

Dimitry Zolotaryov

unread,
Jul 26, 2011, 5:25:32 PM7/26/11
to Django users
So if I run into performance issues, I can always pipe from Apache to
something like gunicorn and keep Apache serving static media?

Dimitry

On 26 juil, 13:03, Javier Guerra Giraldez <jav...@guerrag.com> wrote:

CrabbyPete

unread,
Jul 26, 2011, 6:03:42 PM7/26/11
to Django users
I've run django on Windows Server with apache and it was easy to
deploy. Forget IIS. I've deployed Nginx and uWSGI on linux and that
was even easier.
I've never done Nginx on windows, but I don't think it would be a big
deal.

CrabbyPete

unread,
Jul 26, 2011, 6:05:34 PM7/26/11
to Django users
PS, I used mod_wsgi and make sure you have the latest pywin32

Andre Terra

unread,
Jul 26, 2011, 6:10:37 PM7/26/11
to django...@googlegroups.com
I recently compiled nginx with an additional module on windows and so far, so good. I'm probably skipping Apache altogether for this small website.

As far as PostgreSQL goes, from what I've seen, it works flawlessly on Windows. Never heard of anyone complaining about that.


Cheers,
AT

Michael Manfre

unread,
Jul 26, 2011, 7:27:40 PM7/26/11
to Django users
I have a decent amount of experience with running apache, mod_wsgi and
django on windows (w/ MS SQL). Apache's process module on windows
(mpm_winnt) may result in you having to configure around some serious
GIL related performance issues. You might not hit the problems if the
site is low traffic. You can work around it with a load balancer
(either apache, haproxy, or other of your choice) sitting in front of
several apache instances on the same machine with ideally each having
their processor affinity set to a different, single processor. You'll
need to keep the threads per child low to avoid memory bloat. This set
up basically fakes the other process modules available on linux.

I also did a bit of testing with nginx on windows. It's very resource
efficient and fast, but it didn't run well as a service on windows. It
orphaned processes when restarting the service.

Regards,
Michael Manfre

Dimitry Zolotaryov

unread,
Jul 26, 2011, 8:08:34 PM7/26/11
to Django users
Thanks to everyone for your time.

Michael, I have found a similar GIL-related issue on ServerFault:
http://groups.google.com/group/django-users/browse_thread/thread/4c42b458fd5bfba9

Are there ways to code around this limitation? What versions were you
running when you encountered these issues?

Thanks, again.

Dimitry
Reply all
Reply to author
Forward
0 new messages