1

I followed the steps in https://learn.microsoft.com/en-us/azure/app-service/tutorial-python-postgresql-app?tabs=bash%2Cclone&pivots=postgres-single-server#4-deploy-the-code-to-azure-app-service to deploy my Django app to Azure.

Issues:

  1. requirements are not installing so the app is not running. Unsure if this is because I used az webapp up instead of a git branch.

  2. I tried SSH in but connection error's out: SSH CONNECTION CLOSE - Error: connect EHOSTUNREACH 172.16.1.3:2222Error: connect EHOSTUNREACH 172.16.1.3:2222Error: Timed out while waiting for handshakeError: connect EHOSTUNREACH 172.16.1.3:2222

  3. there are articles mentioning whitelisting port 2222 to go over 80*, but I can't seem to find where to do this on the portal. Again, I'm not using a docker image so I can't add a config.

  4. Used kudu file browser and see that requirements.txt is there and correct.

this is the error from log stream:

2021-08-17T15:21:04.475206899Z   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
2021-08-17T15:21:04.475210299Z   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
2021-08-17T15:21:04.475213499Z   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2021-08-17T15:21:04.475216699Z   File "/home/site/wwwroot/backend/wsgi.py", line 12, in <module>
2021-08-17T15:21:04.475219999Z     from django.core.wsgi import get_wsgi_application
2021-08-17T15:21:04.475222999Z ModuleNotFoundError: No module named 'django'
ats-myo
  • 31
  • 3

1 Answers1

0
  • This could be the solution for ModuleNotFoundError: No module named 'django' (as suggested by Jay Gong):

In web.config file, change the <add key="WSGI_HANDLER" value="<your project name>.wsgi.application"/> to django.core.wsgi.get_wsgi_application().

Port 2222 must be exposed inside of the private Vnet your container uses. To do that, include the following line in your Docker file, currently, it seems you need to use Docker image to do that:

EXPOSE 2222 80

You can refer to Things You Should Know: Web Apps and Linux, Configure a custom container for Azure App Service, Preparing your Docker container for Azure App Services and AZURE WEB APP WITH LINUX CONTAINER SSH LOGIN ISSUE

Ecstasy
  • 1,866
  • 1
  • 9
  • 17