Я на windows сервере 2012. Я создал API на Django rest-framework и пытаюсь развернуть его, используя WAMP и mod_wsgi. Я протестировал API, запустив «python manage.py runserver», и он дал ожидаемый результат. Проблема заключается в том, что когда я развертываю его на WAMp с помощью mod_wsgi, я могу запустить службу WAMP, но когда я пытаюсь связаться с 'localhost', выдается следующая ошибка:
ниже приведена трассировка:
Environment:
Request Method: GET
Request URL: http://localhost:8089/
Django Version: 3.0.5
Python Version: 3.7.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'API']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\django\core\handlers\base.py", line 100, in _get_response
resolver_match = resolver.resolve(request.path_info)
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\django\urls\resolvers.py", line 544, in resolve
for pattern in self.url_patterns:
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\django\urls\resolvers.py", line 588, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\django\urls\resolvers.py", line 581, in urlconf_module
return import_module(self.urlconf_name)
File "c:\python376\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
<source code not available>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
<source code not available>
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
<source code not available>
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
<source code not available>
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
<source code not available>
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
<source code not available>
File "C:/Users/Administrator/Envs/predenv/Predictor\Predictor\urls.py", line 18, in <module>
from API import views
File "C:/Users/Administrator/Envs/predenv/Predictor\API\views.py", line 2, in <module>
from API.apps import ApiConfig
File "C:/Users/Administrator/Envs/predenv/Predictor\API\apps.py", line 10, in <module>
class ApiConfig(AppConfig):
File "C:/Users/Administrator/Envs/predenv/Predictor\API\apps.py", line 13, in ApiConfig
new_customer_model = pickle.load(new_customer_model_pkl)
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\statsmodels\genmod\__init__.py", line 1, in <module>
from statsmodels.tools._testing import PytestTester
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\statsmodels\tools\__init__.py", line 1, in <module>
from .tools import add_constant, categorical
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\statsmodels\tools\tools.py", line 4, in <module>
import numpy as np
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\Administrator\Envs\predenv\Lib\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "c:\python376\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
Exception Type: OSError at /
Exception Value: [WinError 193] %1 is not a valid Win32 application