See comments below.
> On 12 Dec 2018, at 11:06 pm, Anderson Marques <[email protected]> wrote:
>
> Hi, I'm implementing a rest for face recognition using django rest full,
> apache 2.4, python 3.7, wsgi 4.6.5, dlib and opencv running on a centos 7.5,
> but I'm having the following error:
>
> File "/var/www/html/facepy/facedetect/wsgi.py", line 40, in <module>
> [Wed Dec 12 09: 51: 15.345039 2018] [wsgi: error] [pid 75969] application =
> get_wsgi_application ()
> [Wed Dec 12 09: 51: 15.345048 2018] [wsgi: error] [pid 75969] File
> "/var/www/html/facepy/venv/lib/python3.7/site-packages/django/core/wsgi.py ",
> line 12, in get_wsgi_application
> [Wed Dec 12 09: 51: 15.345053 2018] [wsgi: error] [pid 75969] django.setup
> (set_prefix = False)
> [Wed Dec 12 09: 51: 15.345062 2018] [wsgi: error] [pid 75969] File
> "/var/www/html/facepy/venv/lib/python3.7/site-packages/django/__init__.py",
> line 19, in setup
> [Wed Dec 12 09: 51: 15.345066 2018] [wsgi: error] [pid 75969]
> configure_logging (settings.LOGGING_CONFIG, settings.LOGGING)
> [Wed Dec 12 09: 51: 15.345074 2018] [wsgi: error] [pid 75969] File
> "/var/www/html/facepy/venv/lib/python3.7/site-packages/django/conf/__init__.py
> ", line 57, in __getattr__
> [Wed Dec 12 09: 51: 15.345079 2018] [wsgi: error] [pid 75969] self._setup
> (name)
> [Wed Dec 12 09: 51: 15.345087 2018] [wsgi: error] [pid 75969] File
> "/var/www/html/facepy/venv/lib/python3.7/site-packages/django/conf/__init__.py
> ", line 44, in _setup
> [Wed Dec 12 09: 51: 15.345100 2018] [wsgi: error] [pid 75969] self._wrapped =
> Settings (settings_module)
> [Wed Dec 12 09: 51: 15.345109 2018] [wsgi: error] [pid 75969] File
> "/var/www/html/facepy/venv/lib/python3.7/site-packages/django/conf/__init__.py
> ", line 107, in __init__
> [Wed Dec 12 09: 51: 15.345113 2018] [wsgi: error] [pid 75969] mod =
> importlib.import_module (self.SETTINGS_MODULE)
> [Wed Dec 12 09: 51: 15.345122 2018] [wsgi: error] [pid 75969] File
> "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
> [Wed Dec 12 09: 51: 15.345126 2018] [wsgi: error] [pid 75969] return
> _bootstrap._gcd_import (name [level:], package, level)
> [Wed Dec 12 09: 51: 15.345134 2018] [wsgi: error] [pid 75969] File "<frozen
> importlib._bootstrap>", line 1006, in _gcd_import
> [Wed Dec 12 09: 51: 15.345143 2018] [wsgi: error] [pid 75969] File "<frozen
> importlib._bootstrap>", line 983, in _find_and_load
> [Wed Dec 12 09: 51: 15.345151 2018] [wsgi: error] [pid 75969] File "<frozen
> importlib._bootstrap>", line 953, in _find_and_load_unlocked
> [Wed Dec 12 09: 51: 15.345160 2018] [wsgi: error] [pid 75969] File "<frozen
> importlib._bootstrap>", line 219, in _call_with_frames_removed
> [Wed Dec 12 09: 51: 15.345168 2018] [wsgi: error] [pid 75969] File "<frozen
> importlib._bootstrap>", line 1006, in _gcd_import
> [Wed Dec 12 09: 51: 15.345177 2018] [wsgi: error] [pid 75969] File "<frozen
> importlib._bootstrap>", line 983, in _find_and_load
> [Wed Dec 12 09: 51: 15.345185 2018] [wsgi: error] [pid 75969] File "<frozen
> importlib._bootstrap>", line 965, in _find_and_load_unlocked
> [Wed Dec 12 09: 51: 15.345205 2018] [wsgi: error] [pid 75969]
> ModuleNotFoundError:
> [Wsgi: error] [pid 75969] [remote 172.30.212.65:63731] mod_wsgi (pid =
> 75969): Target WSGI script '/ var / www / html / facepy / facedetect /
> wsgi.py 'does not contain WSGI application' application '.
>
> the facepy.conf file looks like this:
> <VirtualHost *: 80>
> ServerName facepy
> ErrorLog /var/log/httpd/errorface.log
>
> DocumentRoot / var / www / html / facepy
> WSGIScriptAlias ??/var/www/html/facepy/facedetect/wsgi.py
> <Directory / var / www / html / facepy / facedetect>
> <Files wsgi.py>
> Require all granted
> </ Files>
> </ Directory>
>
> # adjust the following line to match your Python path
> WSGIDaemonProcess face processes = 2 threads = 95 display-name =% {GROUP}
> user = apache group = apache header-buffer-size = 99255932768 python-home = /
> var / www / html / facepy / venv python-path = / var / www / html / facepy /
> venv / lib / python3.7 / site-packages
Don't know why you are doing it, but you should not be adding
'header-buffer-size=99255932768' option like that. That is a ridiculously large
size to use and could result in failures as tries to allocate that amount of
memory.
As part of solution to you problem, although you might not even need it, add
the option:
startup-timeout=15
>
> <directory / var / www / html / facepy>
> WSGIProcessGroup face
> WSGIApplicationGroup% {GLOBAL}
> WSGIScriptReloading On
You don't need 'WSGIScriptReloading On' as that is the default.
> Require all granted
> </ directory>
>
> Alias ??/ static / / var / www / html / facepy / static /
>
> <Directory / var / www / html / facepy / static>
> Require all granted
> </ Directory>
> </ VirtualHost>
>
>
> the wsgi.py file
> import
> import time
> import traceback
> import signal
> import sys
>
> from django.core.wsgi import get_wsgi_application
>
> # sys.path.append ('/ var / www / html / facepy')
> # adjust the Python version in the line below as needed
> sys.path.append ('/ var / www / html / facepy / venv / lib / python3.7 /
> site-packages')
>
> # os.environ.setdefault ("DJANGO_SETTINGS_MODULE", "facedetect.settings")
> os.environ ['DJANGO_SETTINGS_MODULE'] = 'facedetect.settings'
>
> try:
> application = get_wsgi_application ()
> except Exception:
> # Error loading applications
> if 'mod_wsgi' in sys.modules:
> traceback.print_exc ()
> os.kill (os.getpid (), signal.SIGINT)
> time.sleep (2.5)
Replace this whole try/except block with just:
application = get_wsgi_application()
The startup-timeout option above is better solution for failures on reentrant
import failures which that code trick was likely for. It is that code which is
likely causing your problems because there is a path through the code which can
result in application not being defined, but no error being generated.
>
>
> Someone could tell me what I'm doing wrong.
>
> Thank you very much in advance.
>
> ps I'm in Brazil, I'm sorry English
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.