Importing opencv before deployment worked fine for my django project, but deploying to apache was an error. Later I wrote a project that only used opencv to read images, but still deployed to apache with errors.
[Wed Jul 03 15:44:57.683431 2024] [mpm_winnt:notice] [pid 8204:tid 392] AH00455: Apache/2.4.59 (Win64) mod_wsgi/4.9.2 Python/3.8 configured -- resuming normal operations
[Wed Jul 03 15:44:57.683431 2024] [mpm_winnt:notice] [pid 8204:tid 392] AH00456: Apache Lounge VS17 Server built: Apr 4 2024 15:03:17
[Wed Jul 03 15:44:57.683431 2024] [core:notice] [pid 8204:tid 392] AH00094: Command line: 'F:\bushu\code\Apache24\bin\httpd.exe -d F:/bushu/code/Apache24 -f F:\bushu\code\Apache24\conf\httpd-cv2_text.conf'
[Wed Jul 03 15:44:57.693432 2024] [mpm_winnt:notice] [pid 8204:tid 392] AH00418: Parent: Created child process 3884
[Wed Jul 03 15:44:58.058334 2024] [mpm_winnt:notice] [pid 3884:tid 396] AH00354: Child: Starting 64 worker threads.
[Wed Jul 03 15:45:53.993438 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] mod_wsgi (pid=3884): Exception occurred processing WSGI script 'F:/bushu/code/code/cv2_text/cv2_text/wsgi.py'.
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] Traceback (most recent call last):r
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\core\handlers\exception.py", line 55, in innerr
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] response = get_response(request)r
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\core\handlers\base.py", line 181, in _get_responser
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] callback, callback_args, callback_kwargs = self.resolve_request(request)r
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\core\handlers\base.py", line 313, in resolve_requestr
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] resolver_match = resolver.resolve(request.path_info)r
[Wed Jul 03 15:45:54.085121 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\urls\resolvers.py", line 663, in resolver
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] for pattern in self.url_patterns:r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\utils\functional.py", line 57, in __get__r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] res = instance.__dict__[self.name] = self.func(instance)r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\urls\resolvers.py", line 715, in url_patternsr
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\utils\functional.py", line 57, in __get__r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] res = instance.__dict__[self.name] = self.func(instance)r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\django\urls\resolvers.py", line 708, in urlconf_moduler
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] return import_module(self.urlconf_name)r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\importlib\__init__.py", line 127, in import_moduler
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] return _bootstrap._gcd_import(name[level:], package, level)r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "<frozen importlib._bootstrap>", line 1014, in _gcd_importr
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "<frozen importlib._bootstrap>", line 991, in _find_and_loadr
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlockedr
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "<frozen importlib._bootstrap>", line 671, in _load_unlockedr
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "<frozen importlib._bootstrap_external>", line 783, in exec_moduler
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removedr
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\code\cv2_text\cv2_text\urls.py", line 19, in <module>r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] from .views import read_iamger
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\code\cv2_text\cv2_text\views.py", line 7, in <module>r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] import cv2r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\cv2\__init__.py", line 181, in <module>r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] bootstrap()r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\site-packages\cv2\__init__.py", line 153, in bootstrapr
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] native_module = importlib.import_module("cv2")r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] File "F:\bushu\code\Python38\lib\importlib\__init__.py", line 127, in import_moduler
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] return _bootstrap._gcd_import(name[level:], package, level)r
[Wed Jul 03 15:45:54.086111 2024] [wsgi:error] [pid 3884:tid 1168] [client 127.0.0.1:57001] ImportError: DLL load failed while importing cv2: xe6x89xbexe4xb8x8dxe5x88xb0xe6x8cx87xe5xaex9axe7x9ax84xe6xa8xa1xe5x9dx97xe3x80x82r
The other framework I use is Windows+django+mod_wsgi to deploy.