So I made a huge mistake.. We had a running Django app on an Ubuntu server on AWS I was in the process of updating the website, and after I pulled my latest ORIGIN, everything was ok, and the changes were applied.
Ubuntu asked me to update/upgrade 150+ packages + 2 important security ones.. I am mostly a front-end developer and this was very new to me, so I thought what's the worst that can happen?
I used the command do-release-upgrade as Ubuntu suggested, and I wish it did not..
After everything was done updating, the website crashed, and the error log is being filled up by this error:
[Fri Jun 07 07:36:52.723940 2019] [authz_core:error] [pid 9174:tid 139960510220032] [client 202.142.63.118:42070] AH01630: client denied by server configuration: /home/ubuntu/foodlegal/foodlegal-repo/foodlegal/uploads/documents/1704.pdf$
[Fri Jun 07 17:37:27.338040 2019] [wsgi:error] [pid 9171:tid 139960774047488] ERROR django.security.DisallowedHost 2019-06-07 17:37:24,205 exception 9171 139960774047488 /home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/djang$
//this is when the website was working last, below is when it stopped
[Fri Jun 07 07:39:24.035879 2019] [mpm_event:notice] [pid 9168:tid 139960902834048] AH00491: caught SIGTERM, shutting down
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
File "/home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/PIL/Image.py", line 572, in __del__
NameError: name 'hasattr' is not defined
[Fri Jun 07 07:39:55.591467 2019] [wsgi:warn] [pid 1243:tid 139820063610752] mod_wsgi: Compiled for Python/3.5.1+.
[Fri Jun 07 07:39:55.593400 2019] [wsgi:warn] [pid 1243:tid 139820063610752] mod_wsgi: Runtime using Python/3.5.2.
[Fri Jun 07 07:39:55.594420 2019] [mpm_event:notice] [pid 1243:tid 139820063610752] AH00489: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations
[Fri Jun 07 07:39:55.594443 2019] [core:notice] [pid 1243:tid 139820063610752] AH00094: Command line: '/usr/sbin/apache2'
[Fri Jun 07 17:40:18.502102 2019] [wsgi:error] [pid 1247:tid 139819934824192] ERROR django.request 2019-06-07 17:40:18,499 exception 1247 139819934824192 /home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/django/core/handlers/$
[Fri Jun 07 17:40:18.502158 2019] [wsgi:error] [pid 1247:tid 139819934824192] Traceback (most recent call last):
[Fri Jun 07 17:40:18.502161 2019] [wsgi:error] [pid 1247:tid 139819934824192] File "/home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
[Fri Jun 07 17:40:18.502165 2019] [wsgi:error] [pid 1247:tid 139819934824192] response = get_response(request)
[Fri Jun 07 17:40:18.502167 2019] [wsgi:error] [pid 1247:tid 139819934824192] File "/home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
[Fri Jun 07 17:40:18.502170 2019] [wsgi:error] [pid 1247:tid 139819934824192] response = self._get_response(request)
[Fri Jun 07 17:40:18.502173 2019] [wsgi:error] [pid 1247:tid 139819934824192] File "/home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
[Fri Jun 07 17:40:18.502176 2019] [wsgi:error] [pid 1247:tid 139819934824192] response = self.process_exception_by_middleware(e, request)
[Fri Jun 07 17:40:18.502178 2019] [wsgi:error] [pid 1247:tid 139819934824192] File "/home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
[Fri Jun 07 17:40:18.502181 2019] [wsgi:error] [pid 1247:tid 139819934824192] response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Fri Jun 07 17:40:18.502184 2019] [wsgi:error] [pid 1247:tid 139819934824192] File "/home/ubuntu/foodlegal/foodlegal-repo/inhouse/views.py", line 2052, in get_document_file_two
[Fri Jun 07 17:40:18.502186 2019] [wsgi:error] [pid 1247:tid 139819934824192] fo = open(file_path, "rb")
[Fri Jun 07 17:40:18.502190 2019] [wsgi:error] [pid 1247:tid 139819934824192] FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/foodlegal/foodlegal-repo/foodlegal/uploads/documents/181.pdf'
[Fri Jun 07 17:40:18.502196 2019] [wsgi:error] [pid 1247:tid 139819934824192]
[Fri Jun 07 07:43:20.381484 2019] [authz_core:error] [pid 1250:tid 139819699070720] [client 202.142.63.118:42268] AH01630: client denied by server configuration: /home/ubuntu/foodlegal/foodlegal-repo/foodlegal/uploads/documents/1704.pdf$
[Fri Jun 07 07:44:59.388064 2019] [mpm_event:notice] [pid 1243:tid 139820063610752] AH00491: caught SIGTERM, shutting down
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
File "/home/ubuntu/foodlegal/foodlegal/lib/python3.5/site-packages/PIL/Image.py", line 572, in __del__
NameError: name 'hasattr' is not defined
[Fri Jun 07 07:48:56.811621 2019] [mpm_event:notice] [pid 12808:tid 140344454007744] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.0g mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri Jun 07 07:48:56.811709 2019] [core:notice] [pid 12808:tid 140344454007744] AH00094: Command line: '/usr/sbin/apache2'
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
[Fri Jun 07 07:48:56.811709 2019] [core:notice] [pid 12808:tid 140344454007744] AH00094: Command line: '/usr/sbin/apache2'
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
//and it keeps repeating
I have been researching for literally 7 hours, and I have tried many solutions that other people suggested like creating a new virtual environment.
It's been suggested to try and reset PYTHONHOME and PYTHONPATH, but I have been trying, I am not experienced with Python nor Django at all.
Server version: Apache/2.4.29 (Ubuntu)
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
Python Current version: 3.5.2
Stupid me did not take a snapshot of the server as I thought I wouldn't need it...
I could use all the help I can get. What can you suggest for me?