1

I knew that for deploying a Django application we have to use a combination of uWSGI + Nginx or Nginx + Gunicorn server. Is that necessary? I have a small doubt here. Can we deploy the entire application only in Nginx or only in Gunicorn? Will, it not work? Just for an example(leaving production) can't I do that?

1
  • There seems to be some debate and I would just like to add that my preferred setup for Django is on a Ubuntu Linux server with an Apache server configuration. That's all you need to go live on a AWS Linux server. Commented Apr 8, 2024 at 2:57

2 Answers 2

1

YES , you can. NO, you shouldn't.

If you run your app (in my case Django), on its development server. You can access it from a remote computer at its ip_address:port_number which should look something like 123.142.524.110:8000 and you can see your app at work.

You can also run Django with only gunicorn, it will still lack the web servers capabilities like sering static files efficiently or handling slow clients or DDOS handling. But it will run and that is all I can promise.

Unsure of whether Nginx can be directly tried with DJANGO app server, but I don't see why not. <<Probably someone else can attest to having successfully 'tried' it>>

I should repeat again, just coz its possible doesn't mean you should do it.

Sign up to request clarification or add additional context in comments.

Comments

0

Deploying a Django application using just Nginx or Gunicorn is not technically possible. Here's why:

  1. Nginx: Nginx is great at efficiently serving static content and functioning as a reverse proxy. It can handle HTTP requests and route them to backend servers such as Gunicorn or uWSGI. However, Nginx lacks the ability to directly execute Python code. Therefore, deploying a Django application solely with Nginx is not feasible.

  2. Gunicorn: Gunicorn (Green Unicorn) is a Python WSGI HTTP server used for running Python web applications. It is commonly paired with Nginx as a WSGI server for Django apps. But Gunicorn is not a standalone web server like Nginx; it is meant to be used with api. It's designed to work with application frameworks like Django and needs a web server (like Nginx or Apache) to handle incoming requests and act as a reverse proxy.

In a typical deployment setup, Nginx is used as a reverse proxy to handle incoming HTTP requests, while Gunicorn (or uWSGI) serves as the WSGI server to execute the Django application code. This setup provides benefits such as load balancing, static file serving, and improved security.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.