Best Django Deployment

95 views
Skip to first unread message

Motaz Hejaze

unread,
Jan 22, 2020, 11:38:53 AM1/22/20
to Django users
Hey Friends!

I want to ask what is the best Django deployment stack to increase the request/per/second rate ??

does Nginx have better performance than apache ?

What about Gunicorn and other alternatives ?

thank you very much 

Motaz Hejaze

unread,
Jan 23, 2020, 2:45:38 PM1/23/20
to Django users
Any help friends ?

Aldian Fazrihady

unread,
Jan 23, 2020, 9:11:47 PM1/23/20
to django...@googlegroups.com
Google AppEngine fFex will handle everything for you, but for my requirement, the price is too expensive, so I don't use it and I also don't use any Google cloud product to host my Django app.
If your app code is not efficient, it means it will use more resources, then the monthly bill of AppEngine Flex will also be higher.

Google AppEngine flex is using nginx. 

On Fri, Jan 24, 2020 at 2:46 AM Motaz Hejaze <trapp...@gmail.com> wrote:
Any help friends ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/841a0431-f1c0-473b-85df-4e6377f2bbdd%40googlegroups.com.


--
Regards,

onlinejudge95

unread,
Jan 23, 2020, 11:15:50 PM1/23/20
to django...@googlegroups.com
+1 on the question.
Mainly whether the Apache + modWSGI or Nginx is the better way to go.

Mike Dewhirst

unread,
Jan 24, 2020, 2:57:41 AM1/24/20
to django...@googlegroups.com
On 24/01/2020 3:14 pm, onlinejudge95 wrote:
> +1 on the question.
> Mainly whether the Apache + modWSGI or Nginx is the better way to go.

I use Apache + modWSGI because I'm familiar with it. I also run a
Mezzanine site which uses Gunicorn + nginx and the setup wasn't difficult.

I don't think performance is an immediate issue for most sites so my
advice is:

1.  go for what you are familiar with.

2. if unfamiliar with both and your setup is simple go for nginx because
setup is simpler

3. if brilliant documentation is your thing and you have complex
requirements go with Apache

4. if the last nanosecond of performance is your thing get an expert to
tune up whichever one you choose because only experts can tell the
difference.

Good luck

Mike

>
> On Fri, Jan 24, 2020, 7:41 AM Aldian Fazrihady <mob...@aldian.net
> <mailto:mob...@aldian.net>> wrote:
>
> Google AppEngine fFex will handle everything for you, but for my
> requirement, the price is too expensive, so I don't use it and I
> also don't use any Google cloud product to host my Django app.
> If your app code is not efficient, it means it will use more
> resources, then the monthly bill of AppEngine Flex will also be
> higher.
>
> Google AppEngine flex is using nginx.
>
> On Fri, Jan 24, 2020 at 2:46 AM Motaz Hejaze <trapp...@gmail.com
> <mailto:trapp...@gmail.com>> wrote:
>
> Any help friends ?
>
> --
> You received this message because you are subscribed to the
> Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to django-users...@googlegroups.com
> <mailto:django-users%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/841a0431-f1c0-473b-85df-4e6377f2bbdd%40googlegroups.com.
>
>
>
> --
> Regards,
>
> Aldian Fazrihady
> http://aldianfazrihady.com
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN7EoAbT10tmK87u_kLVLqYHV-JUnBgEPDziq%3DjfTwXkfjqzLA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAN7EoAbT10tmK87u_kLVLqYHV-JUnBgEPDziq%3DjfTwXkfjqzLA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAD%3DM5eTMot%3D59RCXhDkwwdQZDU7bCioJuFd2x-SFJr2UboYFZA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAD%3DM5eTMot%3D59RCXhDkwwdQZDU7bCioJuFd2x-SFJr2UboYFZA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Motaz Hejaze

unread,
Jan 25, 2020, 3:05:44 AM1/25/20
to Django users
I found this comparison on a blog ..

Apache vs Nginx

https://www.hostingadvice.com/how-to/nginx-vs-apache/

Nick Sarbicki

unread,
Jan 25, 2020, 6:10:51 AM1/25/20
to Django users
I've used nginx+gunicorn/uwsgi, Apache+modwsgi, Google app engine flex, Google app engine standard, heroku, kubernetes on various cloud platforms, elastic beanstalk deployments and various others.

Realistically I don't think there is a "best" way. It all depends on your environment, what you're working with and what you know.

If you're new to deploying Django I'd just follow the digital ocean guide with nginx and gunicorn here: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

It teaches you the basics of what you want to know.

In the end every style of deployment has its ups and downs so I'd just use whatever works best for you. If you don't know what that is then try whatever seems simplest (in my opinion that digital ocean guide) and feel free to evolve and adapt from there.

One thing I would say though is to avoid app engine flex. It's just a wrapper around Google compute engine for 6x the price. It promises scalability but realistically the latency in bringing up new machines voids that. Luckily the latest standard engine supports python 3 and Django and is much faster so is ok to use (with a lot of work around connecting to databases).

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8fdeda69-15ad-4997-9806-31c437ee2416%40googlegroups.com.

Motaz Hejaze

unread,
Jan 25, 2020, 6:41:54 AM1/25/20
to django...@googlegroups.com
Guys thank you all for all your answers .. 

I think i'll go with Nginx rather than Apache , Apache seems to have more options , but also seems old , complicated and heavy !

Now i want to consider which layer of integration with web server to use , i.e should i user Nginx/Gunicorn or Nginx/uwsgi ?? are there any performance gain ?

What about running Django in an Asynchronous way , i mean using django with Asgi rather than Usgi ?? any performance gain too ??

Nick Sarbicki

unread,
Jan 25, 2020, 9:09:20 AM1/25/20
to Django users
As far as I'm aware the performance difference between gunicorn and uwsgi is minimal. I prefer gunicorn but I have no real rationale for why.

For ASGI Vs WSGI, WSGI is the historical standard most things are built on so is by far the easiest to start with. ASGI requires a fundamental change in how you think about your web services and whilst Django does support ASGI nowadays it is still only experimental support. As a starting point I'd stick with WSGI, ASGI has some benefits but early on the learning curves make WSGI the logical choice.


Motaz Hejaze

unread,
Jan 25, 2020, 9:51:56 AM1/25/20
to django...@googlegroups.com
They talking about making django asynchronous nature by the version 3.3 ..
i can see that asynchronous model is high speed and performance like in node.js 
i don't know if that will be applicable to django 


Motaz Hejaze

unread,
Jan 25, 2020, 1:19:45 PM1/25/20
to django...@googlegroups.com

aakansha jain

unread,
Jan 25, 2020, 1:38:59 PM1/25/20
to django...@googlegroups.com
Can anyone tell me how to run the django development environment so that I can contribute to Django.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

aakansha jain

unread,
Jan 25, 2020, 1:40:42 PM1/25/20
to Django users
Can anyone tell me how to run the django development environment so that I can contribute to Django.

Motaz Hejaze

unread,
Jan 25, 2020, 3:06:12 PM1/25/20
to django...@googlegroups.com
make another thread for your question man , this is out of the topic of this thread

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages