http://mydomain.jp/にアクセスしたときにDjango(python)のアプリケーションを使える環境にしたいのですが、
どうも設定がうまく出来てないようで、http://mydomain.jp/にアクセスしてもInternal Server Errorが出てしまいます。
(mydomainは私が取得しているドメイン名としてください)
WSGIScriptAlias / /var/www/site/wsgi.py
具体的には/var~~からの先のコードなのですが
- mod_wsgiをインストールした際に作られたファイルのパスを指定?
- 実行したいファイルパス(/var/www/site/hello.py)を指定?
- http://mydomain.jpはどこにも記述しなくてもよいのか?
はたまた、まったく関係ないところで設定が出来ていないのでしょうか・・。
当方の環境は下記のとおりです
(index.htmlを使用すればhttp://mydomain.jpから開くことができていますのでApacheは正常に動作しています)
Python 3.5.3
CentOS 7.3.1611
Apache 2.4.6
MySQL5.7.18
試しているコード全文です↓
[httpd.conf]
WSGIDaemonProcess test-app user=test group=wheel threads=5 WSGIScriptAlias / /var/www/site/wsgi.py <Directory /var/www/site/> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory>
[/var/www/site/hello.py]
def application(environ,start_response): status = '200 OK' output = 'Hello World!' response_header = [('Content-type','text/plain'), ('Content-Length',str(len(output)))] start_response(status,response_header) return [output]
ディレクトリ構造↓
/var/www/site/
|-- init.py
|-- pycache
| |-- init.cpython-35.pyc
| |-- settings.cpython-35.pyc
| |-- urls.cpython-35.pyc
| `-- wsgi.cpython-35.pyc
| --hello.py
| --settings.py
| --urls.py
| --wsgi.py
[apache error_log]
[Sun Jul 09 13:58:11.082066 2017] [mpm_prefork:notice] [pid 27140] AH00170: caught SIGWINCH, shutting down gracefully [Sun Jul 09 13:58:12.198682 2017] [suexec:notice] [pid 27265] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Sun Jul 09 13:58:12.218016 2017] [auth_digest:notice] [pid 27265] AH01757: generating secret for digest authentication ... [Sun Jul 09 13:58:12.218726 2017] [lbmethod_heartbeat:notice] [pid 27265] AH02282: No slotmem from mod_heartmonitor [Sun Jul 09 13:58:12.223378 2017] [mpm_prefork:notice] [pid 27265] AH00163: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations [Sun Jul 09 13:58:12.223404 2017] [core:notice] [pid 27265] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Sun Jul 09 13:58:15.424388 2017] [:error] [pid 27271] [client 111.104.38.104:60837] No WSGI daemon process called 'yourapp' has been configured: /var/www/site/wsgi.py
参考にした資料
https://teratail.com/questions/80949
http://docs.djangoproject.jp/en/latest/howto/deployment/wsgi/modwsgi.html
http://qiita.com/mtb_beta/items/f5fd4bc0341e3f8f462a
回答2件
あなたの回答
tips
プレビュー