Django in Ubuntu 18.04 on Azure VM gunicorn Can't connect to ('0.0.0.0', 80)

I'm trying to deploy my Django application to Azure virtual machine with Ubuntu 18.04.

  1. I have set up the VM and connect to it via SSH.
  2. Then run the update and upgrade command
  3. Setup Python and Virtualenvironment
  4. Upload my code and activate the environment
  5. Allow the port 8000 using sudo ufw allow 8000 for testing
  6. After installing all the requirements, when I run the command:
python manage.py runserver 0.0.0.0:8000

The application runs, but when I open the URL as: :8000/

It doesn't return anything not any errors in the console

Update: It's just fixed by manually adding the port 8000 in azure portal under Inbound port rules. But: when I try to run it via gunicorn as:
gunicorn --pythonpath PROJECT PROJECT.wsgi:application --log-file - --bind 0.0.0.0:80

it returns another error as below:

[30007] [ERROR] Can't connect to ('0.0.0.0', 80)

What can be wrong here?

#python #azure #django #ubuntu

4 Likes26.45 GEEK