2017-06-14 1 views
0

誰かが私を助け、何が間違っていると言うことができますか?DjangoとApacheを使用するには?

私はDjango + Apacheを使用する必要があります。

私は、Apacheを起動しようとすると、それはエラーを私に示していますThe requested operation has failed.

私は異なる値にListen 80を変更しようとしましたが、それは助けをdidntの。 (これらの設定Apacheは罰金を開始せずに)また、このエラーはhttpd.confファイルに次の設定を追加した後に表示されます。

LoadModule wsgi_module modules/mod_wsgi.so 
# Virtual hosts 
Include conf/extra/httpd-vhosts.conf 

は、私が使用します。

1)はApache 2.4(x64)の

2)のPython 3.5。 2(x64)の

3)ジャンゴ1.10.5

4)のmod_wsgi-4.5.15 + ap24vc14-cp35-cp35m-win_amd64.whl

5)Windows 8.1(x64)

多分私は間違ってmod_wsgiを使用しますか?私はmod_wsgi‑4.5.15+ap24vc14‑cp35‑cp35m‑win_amd64.whlからmod_wsgi.cp35-win_amd64.pydファイルを取り出し、そのファイルの名前をmod_wsgi.soに変更します。その後、そのファイルをApacheのmodulesフォルダに置きます。

のerror.logファイルには、次のようになります。

[Wed Jun 14 21:42:30.381146 2017] [mpm_winnt:notice] [pid 11892:tid 692] AH00455: Apache/2.4.2 (Win64) configured -- resuming normal operations 
[Wed Jun 14 21:42:30.381146 2017] [mpm_winnt:notice] [pid 11892:tid 692] AH00456: Server built: May 11 2012 20:42:30 
[Wed Jun 14 21:42:30.381146 2017] [core:notice] [pid 11892:tid 692] AH00094: Command line: 'C:\\Program Files\\Apache2.4\\bin\\httpd.exe -d C:/Program Files/Apache2.4 -f C:\\Program Files\\Apache2.4\\conf\\httpd.conf -d C:\\Program Files\\Apache2.4\\.' 
[Wed Jun 14 21:42:30.381146 2017] [mpm_winnt:notice] [pid 11892:tid 692] AH00418: Parent: Created child process 13624 
[Wed Jun 14 21:42:30.646739 2017] [mpm_winnt:notice] [pid 13624:tid 328] AH00354: Child: Starting 64 worker threads. 
[Wed Jun 14 21:42:40.736467 2017] [mpm_winnt:notice] [pid 11892:tid 692] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Wed Jun 14 21:42:42.759516 2017] [mpm_winnt:notice] [pid 13624:tid 328] AH00364: Child: All worker threads have exited. 
[Wed Jun 14 21:42:42.775140 2017] [mpm_winnt:notice] [pid 11892:tid 692] AH00430: Parent: Child process exited successfully. 
[Wed Jun 14 21:42:51.755536 2017] [mpm_winnt:notice] [pid 7988:tid 696] AH00455: Apache/2.4.2 (Win64) configured -- resuming normal operations 
[Wed Jun 14 21:42:51.756537 2017] [mpm_winnt:notice] [pid 7988:tid 696] AH00456: Server built: May 11 2012 20:42:30 
[Wed Jun 14 21:42:51.756537 2017] [core:notice] [pid 7988:tid 696] AH00094: Command line: 'C:\\Program Files\\Apache2.4\\bin\\httpd.exe -d C:/Program Files/Apache2.4 -f C:\\Program Files\\Apache2.4\\conf\\httpd.conf -d C:\\Program Files\\Apache2.4\\.' 
[Wed Jun 14 21:42:51.757538 2017] [mpm_winnt:notice] [pid 7988:tid 696] AH00418: Parent: Created child process 8692 
[Wed Jun 14 21:42:51.973446 2017] [mpm_winnt:notice] [pid 8692:tid 636] AH00354: Child: Starting 64 worker threads. 
[Wed Jun 14 21:59:11.710766 2017] [mpm_winnt:notice] [pid 7988:tid 696] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Wed Jun 14 21:59:13.712698 2017] [mpm_winnt:notice] [pid 8692:tid 636] AH00364: Child: All worker threads have exited. 
[Wed Jun 14 21:59:13.731009 2017] [mpm_winnt:notice] [pid 7988:tid 696] AH00430: Parent: Child process exited successfully. 
[Wed Jun 14 23:12:16.868389 2017] [mpm_winnt:notice] [pid 7988:tid 692] AH00455: Apache/2.4.2 (Win64) configured -- resuming normal operations 
[Wed Jun 14 23:12:16.869389 2017] [mpm_winnt:notice] [pid 7988:tid 692] AH00456: Server built: May 11 2012 20:42:30 
[Wed Jun 14 23:12:16.869389 2017] [core:notice] [pid 7988:tid 692] AH00094: Command line: 'C:\\Program Files\\Apache2.4\\bin\\httpd.exe -d C:/Program Files/Apache2.4 -f C:\\Program Files\\Apache2.4\\conf\\httpd.conf -d C:\\Program Files\\Apache2.4\\.' 
[Wed Jun 14 23:12:16.870391 2017] [mpm_winnt:notice] [pid 7988:tid 692] AH00418: Parent: Created child process 7152 
[Wed Jun 14 23:12:17.107601 2017] [mpm_winnt:notice] [pid 7152:tid 616] AH00354: Child: Starting 64 worker threads. 
[Wed Jun 14 23:12:24.939591 2017] [mpm_winnt:notice] [pid 7988:tid 692] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Wed Jun 14 23:12:26.941397 2017] [mpm_winnt:notice] [pid 7152:tid 616] AH00364: Child: All worker threads have exited. 
[Wed Jun 14 23:12:26.960081 2017] [mpm_winnt:notice] [pid 7988:tid 692] AH00430: Parent: Child process exited successfully. 

wsgi.py:

import os, sys 
sys.path.append('C:/Program Files/Apache2.4/htdocs/RMS/RMS') 
sys.path.append('C:/Program Files/Apache2.4/htdocs/RMS') 

os.environ.setdefault["DJANGO_SETTINGS_MODULE"] = "RMS.settings" 

import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandlers() 

のhttpd-vhosts.conf

<VirtualHost *:8080> 
    WSGIScriptAlias /rms 'C:/Program Files/Apache2.4/htdocs/RMS/RMS/wsgi.py' 
    Alias /media/ 'C:/Program Files/Apache2.4/htdocs/RMS/media' 
    Alias /media/ 'C:/Program Files/Apache2.4/htdocs/RMS/media' 

    <Directory "C:/Program Files/Apache2.4/htdocs/RMS/static"> 
    <Files wsgi.py> 
    Order allow, deny 
    Allow from all 
    </Files> 
    </Directory> 

    <Directory "C:/Program Files/Apache2.4/htdocs/RMS/media"> 
    Order allow, deny 
    Allow from all 
    </Directory> 
</VirtualHost> 

httpd.confの:グラハムによって再びmodwgsi Google Group

Listen 8080 
LoadModule wsgi_module modules/mod_wsgi.so 
# Virtual hosts 
Include conf/extra/httpd-vhosts.conf 
+0

confファイルとwsgiファイルの内容を含めることはできますか? – Tom

+0

こんにちは!私は私がしたすべての設定で自分の投稿を更新します。私は 'httpd.conf'ファイルが大きすぎると言う必要があります。私は編集した部分だけを追加します。何が言えますか?おそらく、私は間違った 'mod_wsgi'ファイルを使用しますか? –

+0

私はこのサイトの 'mod_wsgi'を使用しています:http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi私に何かアドバイスできますか? –

答えて

0

言及Graham Dumpleton方法は私のために働いた方法ですが、私はこの項目に遭遇するのに十分幸運でした。あなたのhttpd.confファイルにコピーする設定を取得するために実行mod_wsgi-express module-config

  • (好ましくはvirtualenvに)ピップを使用して

    1. インストールmod_wsgiは、私がのLoadModuleリストの上にこれらをコピーすることにしました。

    .pydファイルを移動して名前を変更する場合は、そのままにしないでください。例えば、あなたのVirtualHostで

    def application(environ, start_response): 
    status = '200 OK' 
    output = b'Hello World!' 
    
    response_headers = [('Content-type', 'text/plain'), 
            ('Content-Length', str(len(output)))] 
    start_response(status, response_headers) 
    
    return [output] 
    

    、作成したWSGIファイルを指すWSGIScriptAliasを作成します、テストする次の内容のhelloworld.wsgiを作成するにはWSGIScriptAlias /test C:/wsgitest/helloworld.wsgi

  • 関連する問題