Seguí casi toda la documentación oficial para ejecutar mi proyecto Django en mi servidor Ubuntu 18.04 v. Y parece funcionar... sudo service apache2 status -> todo bien también.
[Sun May 03 16:07:20.489608 2020] [mpm_event:notice] [pid 11531:tid 139884218760128] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.7.1 Python/3.8 configured -- resuming normal operations [Sun May 03 16:07:20.489764 2020] [core:notice] [pid 11531:tid 139884218760128] AH00094: Command line: '/usr/sbin/apache2'Primero noté que algo no funcionaba cuando mis plantillas no se actualizaban sin reiniciar el servidor, lo cual no es el comportamiento habitual de Django (incluso en un entorno productivo). Cada vez que reinicio el servidor, aparece este error en apache2/error.log. Aunque el servidor sigue funcionando, quiero llegar al fondo de esto.
Exception ignored in: <function Local.__del__ at 0x7fbd983f03a0> Traceback (most recent call last): File "/var/www/my_app/.my_app/lib/python3.8/site-packages/asgiref/local.py", line 95, in __del__ NameError: name 'AttributeError' is not defined Exception ignored in: <function Local.__del__ at 0x7fbd983f03a0> Traceback (most recent call last): File "/var/www/my_app/.my_app/lib/python3.8/site-packages/asgiref/local.py", line 95, in __del__ NameError: name 'AttributeError' is not defined [Sun May 03 16:07:19.418926 2020] [core:warn] [pid 11433:tid 140452536064960] AH00045: child process 11435 still did not exit, sending a SIGTERM [Sun May 03 16:07:20.419208 2020] [mpm_event:notice] [pid 11433:tid 140452536064960] AH00491: caught SIGTERM, shutting down [Sun May 03 16:07:20.489608 2020] [mpm_event:notice] [pid 11531:tid 139884218760128] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.7.1 Python/3.8 configured -- resuming normal operations [Sun May 03 16:07:20.489764 2020] [core:notice] [pid 11531:tid 139884218760128] AH00094: Command line: '/usr/sbin/apache2'Estructura del proyecto:
in /var/www/: |-- my_app | |-- my_app | | |-- __init__.py | | |-- asgi.py | | |-- settings.py | | |-- urls.py | | `-- wsgi.py | |-- db.sqlite3 | |-- manage.py | |-- media | |-- .my_app (python venv) | |-- my_subapp | | |-- __init__.py | | |-- admin.py | | |-- apps.py | | |-- migrations | | |-- models.py | | |-- tests.py | | |-- urls.py | | `-- views.py | `-- templates | |-- base.html | `-- index.html¿Alguna sugerencia de qué podría estar mal y por qué dice "AttributeError not found?" cuando parece ser una clase estándar de python que se envía con ella lista para usar... Gracias por su ayuda :-)
Me tomó un día descubrir cuál era el problema. Gracias a Graham Dumpleton, el creador de mod_wsgi por explicarlo todo. Puedes buscarlo aquí: