简体   繁体   中英

python34 + django + apache + mod_wsgi error

i'm trying to deploy an Django app to Window Server 2012, but i cant. I would appreciate any help you can borrow.

VHOST:

<VirtualHost *:8080>
    WSGIScriptAlias /zeus "C:/xampp/htdocs/zeus-manager/wsgi.py"
    Alias /zeus/static "C:/xampp/htdocs/zeus-manager/static"
    Alias /zeus/media "C:/xampp/htdocs/zeus-manager/media"
    <Directory "/zeus/media"> 
    Order allow,deny 
    Allow from all 
    </Directory> 
    <Directory "/zeus/static"> 
    Order allow,deny 
    Allow from all 
    </Directory> 
    <Directory "/zeus">
    <Files wsgi.py>
    Require all granted
    </Files>
    </Directory>
</VirtualHost>

WSGI.py

import site
site.addsitedir("C:/Python34/Lib/site-packages")
import os
import sys
sys.path.append("C:/xamp/htdocs/zeus-manager")
from django.core.wsgi import get_wsgi_application
os.environ["DJANGO_SETTINGS_MODULE"] = "zeus_manager.settings"

application = get_wsgi_application()

And this is the apache log: Can anyone help me please?

[Wed Dec 09 21:35:41.455053 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404] mod_wsgi (pid=3392): Target WSGI script 'C:/xampp/htdocs/zeus-manager/wsgi.py' cannot be loaded as Python module.
[Wed Dec 09 21:35:41.455053 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404] mod_wsgi (pid=3392): Exception occurred processing WSGI script 'C:/xampp/htdocs/zeus-manager/wsgi.py'.
[Wed Dec 09 21:35:41.455053 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404] Traceback (most recent call last):\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:/xampp/htdocs/zeus-manager/wsgi.py", line 6, in <module>\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.core.wsgi import get_wsgi_application\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\core\\wsgi.py", line 2, in <module>\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.core.handlers.wsgi import WSGIHandler\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 10, in <module>\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django import http\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\http\\__init__.py", line 5, in <module>\r
[Wed Dec 09 21:35:41.456056 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.http.response import (\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\http\\response.py", line 13, in <module>\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.core.serializers.json import DjangoJSONEncoder\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\core\\serializers\\__init__.py", line 23, in <module>\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.core.serializers.base import SerializerDoesNotExist\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\core\\serializers\\base.py", line 4, in <module>\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.db import models\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\db\\models\\__init__.py", line 13, in <module>\r
[Wed Dec 09 21:35:41.457054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.db.models.fields.files import FileField, ImageField  # NOQA\r
[Wed Dec 09 21:35:41.458054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\db\\models\\fields\\files.py", line 9, in <module>\r
[Wed Dec 09 21:35:41.458054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.core.files.storage import default_storage\r
[Wed Dec 09 21:35:41.458054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\core\\files\\storage.py", line 8, in <module>\r
[Wed Dec 09 21:35:41.458054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from django.core.files import File, locks\r
[Wed Dec 09 21:35:41.458054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\lib\\site-packages\\django\\core\\files\\locks.py", line 31, in <module>\r
[Wed Dec 09 21:35:41.458054 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from ctypes import (sizeof, c_ulong, c_void_p, c_int64,\r
[Wed Dec 09 21:35:41.459082 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]   File "C:\\Python34\\Lib\\ctypes\\__init__.py", line 7, in <module>\r
[Wed Dec 09 21:35:41.459082 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404]     from _ctypes import Union, Structure, Array\r
[Wed Dec 09 21:35:41.459082 2015] [wsgi:error] [pid 3392:tid 1848] [client 127.0.0.1:50404] ImportError: DLL load failed: The specified procedure could not be found.\r

Thanks for the answer

您需要确保Windows,Python,Apache和mod_wsgi都具有相同的体系结构(32位或64位)。此外,请确保您使用的是针对您的Apache版本编译的mod_wsgi。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM