Django app failing to get deployed on Azure web service

I have a Django app that was running without issues till 2 days back on Azure. I then added some Azure OAI code using semantic-kernel and since then haven't been able to complete the deploy step of github actions workflow to deploy the app. To use semantic-kernel, I had to update to python 3.11 from python 3.8 on Azure. The deployment runs for about 40 mins and then errors out.

From docker logs, I see the following issue:ModuleNotFoundError: No module named 'django'

2024-12-30T01:12:32.6106267Z Using packages from virtual environment antenv located at /home/site/wwwroot/antenv. 2024-12-30T01:12:32.6117557Z Updated PYTHONPATH to '/opt/startup/app_logs:/home/site/wwwroot/antenv/lib/python3.11/site-packages' 2024-12-30T01:12:35.1840122Z [2024-12-30 01:12:35 +0000] [84] [INFO] Starting gunicorn 23.0.0 2024-12-30T01:12:35.3134084Z [2024-12-30 01:12:35 +0000] [84] [INFO] Listening at: http://0.0.0.0:8000 (84) 2024-12-30T01:12:35.3205313Z [2024-12-30 01:12:35 +0000] [84] [INFO] Using worker: sync 2024-12-30T01:12:35.3321195Z [2024-12-30 01:12:35 +0000] [89] [INFO] Booting worker with pid: 89 2024-12-30T01:12:35.4238708Z [2024-12-30 01:12:35 +0000] [89] [ERROR] Exception in worker process 2024-12-30T01:12:35.4473148Z Traceback (most recent call last): 2024-12-30T01:12:35.4475461Z File "/opt/python/3.11.10/lib/python3.11/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker 2024-12-30T01:12:35.4476786Z worker.init_process() 2024-12-30T01:12:35.4477986Z File "/opt/python/3.11.10/lib/python3.11/site-packages/gunicorn/workers/base.py", line 135, in init_process 2024-12-30T01:12:35.4479379Z self.load_wsgi() 2024-12-30T01:12:35.4480603Z File "/opt/python/3.11.10/lib/python3.11/site-packages/gunicorn/workers/base.py", line 147, in load_wsgi 2024-12-30T01:12:35.4481752Z self.wsgi = self.app.wsgi() 2024-12-30T01:12:35.4484237Z ^^^^^^^^^^^^^^^ 2024-12-30T01:12:35.4485531Z File "/opt/python/3.11.10/lib/python3.11/site-packages/gunicorn/app/base.py", line 66, in wsgi 2024-12-30T01:12:35.4486749Z self.callable = self.load() 2024-12-30T01:12:35.4487911Z ^^^^^^^^^^^ 2024-12-30T01:12:35.4489069Z File "/opt/python/3.11.10/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 57, in load 2024-12-30T01:12:35.4490218Z return self.load_wsgiapp() 2024-12-30T01:12:35.4491827Z ^^^^^^^^^^^^^^^^^^^ 2024-12-30T01:12:35.4493529Z File "/opt/python/3.11.10/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp 2024-12-30T01:12:35.4496151Z return util.import_app(self.app_uri) 2024-12-30T01:12:35.4497571Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-12-30T01:12:35.4498724Z File "/opt/python/3.11.10/lib/python3.11/site-packages/gunicorn/util.py", line 370, in import_app 2024-12-30T01:12:35.4503737Z mod = importlib.import_module(module) 2024-12-30T01:12:35.4505133Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-12-30T01:12:35.4507753Z File "/opt/python/3.11.10/lib/python3.11/importlib/init.py", line 126, in import_module 2024-12-30T01:12:35.4509384Z return _bootstrap._gcd_import(name[level:], package, level) 2024-12-30T01:12:35.4510611Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-12-30T01:12:35.4511876Z File "", line 1204, in _gcd_import 2024-12-30T01:12:35.4513103Z File "", line 1176, in _find_and_load 2024-12-30T01:12:35.4571053Z File "", line 1147, in _find_and_load_unlocked 2024-12-30T01:12:35.4572360Z File "", line 690, in _load_unlocked 2024-12-30T01:12:35.4573594Z File "", line 940, in exec_module 2024-12-30T01:12:35.4574752Z File "", line 241, in _call_with_frames_removed 2024-12-30T01:12:35.4575942Z File "/home/site/wwwroot/<my_app>/wsgi.py", line 12, in 2024-12-30T01:12:35.4577090Z from django.core.wsgi import get_wsgi_application 2024-12-30T01:12:35.4578220Z ModuleNotFoundError: No module named 'django' 2024-12-30T01:12:35.4888669Z [2024-12-30 01:12:35 +0000] [89] [INFO] Worker exiting (pid: 89) 2024-12-30T01:12:35.7610862Z [2024-12-30 01:12:35 +0000] [84] [ERROR] Worker (pid:89) exited with code 3 2024-12-30T01:12:35.7619628Z [2024-12-30 01:12:35 +0000] [84] [ERROR] Shutting down: Master 2024-12-30T01:12:35.7622636Z [2024-12-30 01:12:35 +0000] [84] [ERROR] Reason: Worker failed to boot.

from Kudo logs, I see that the deployment is stuck at 2024-12-30T02:54:34.5926086Z Activating virtual environment... 2024-12-30T02:54:34.6393062Z Running pip install... 2024-12-30T03:33:42.8129357Z ..............................................................................................................................................................................................................................................................................................................................................................................................................................................

I have tried several ideas listed in different threads such as specifying the sys.path in wsgi.py or creating a new github deployment but no luck.

Any further ideas on what I can try out to fix this issue?

So after multiple long and failed deployments, I finally upgraded everything to work with Python 3.12 - including github actions, packages in requirements.txt and azure web app - and it worked....

Вернуться на верх