1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DjangoでOpenCVが動かないと思った時の対処法

Posted at

Background

try ~ except でもエラーが検知しなかったので、OpenCVとhttpd(Apache)が原因じゃないかと思って調べたらそうだったという話です。

Environment

  • Python 3.6.8
  • Django 2.0
  • Apache 2.4.39

Method

mod_wsgi の設定で1行追加するだけです。

WSGIApplicationGroup %{GLOBAL}

Supplement

他のmod_wsgiはこんな感じ

LoadModule wsgi_module /usr/local/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so

WSGIPythonPath /home/path_to/django_project/:/usr/local/lib/python3.6/site-packages/:/usr/local/lib/python3.6/

WSGIScriptAlias /XXXXX /home/path_to/django_project/setting_folder/wsgi.py

<Directory /home/path_to/django_project/setting_folder/>
        <Files wsgi.py>
                Require all granted
        </Files>
</Directory>

Alias /static/ /home/path_to/django_project/static/
<Directory /home/path_to/django_project/static/>
        Require all granted
</Directory>

Reference

django apache mod-wsgi hangs on importing a python module from .so file

OpenCV imread hanging when called from a web request

Django & Apahce2 アプリケーションにアクセスしても response が来ない。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?