質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

1回答

3347閲覧

mampでpython3.6.4が動かないです。

退会済みユーザー

退会済みユーザー

総合スコア0

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2018/01/19 16:55

###前提・実現したいこと
最終目標としてwordpress上でパイソンを動かしたいと思っています。
まずはpythonを動かすことを目標にしているのですが、そこでつまづいています。
半日つまづいてしまって、そろそろ心が折れそうです、、。

###発生している問題・エラーメッセージ

http://localhost:8888/python/main.py

上記URLにアクセスすると、下記内容がブラウザ上に表示されます。

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

apache_error.logに表示されている内容です。

[Sat Jan 20 01:40:47 2018] [error] [client ::1] mod_wsgi (pid=66536): Target WSGI script '/Applications/MAMP/htdocs/python/main.py' does not contain WSGI application 'application'.

###該当のソースコード

python

1#!~/.pyenv/versions/3.6.4/bin/python3.6 2# coding: UTF-8 3 4print('お疲れ様です。') 5

###試したこと
http://localhost:8888/python/main.pyに対してchmod +x main.pyで実行権限を変更
・apache_error.logの内容を元に、mod_wsgiモジュールをインストールしようとしましたが、エラーが表示されインストールできず。

$pip install mod_wsgi 実行

src/server/wsgi_python.h:24:10: fatal error: 'Python.h' file not found #include <Python.h> ^~~~~~~~~~ 1 error generated. error: command 'clang' failed with exit status 1

###補足情報(言語/FW/ツール等のバージョンなど)

OS : macOS High Sierra
MAMP PRO : version 4.2.1
python3.6.4

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

[Sat Jan 20 01:40:47 2018] [error] [client ::1] mod_wsgi (pid=66536): Target WSGI script '/Applications/MAMP/htdocs/python/main.py' does not contain WSGI application 'application'.

ぐーぐる翻訳
[Sat Jan 20 01:40:47 2018] [error] [client ::1] mod_wsgi (pid=66536): Target WSGI script '/Applications/MAMP/htdocs/python/main.py' WSGIアプリケーション 'application'は含まれていません。

main.pyにapplication メソッドが無いというエラーメッセージに見えますが。
main.pyのprint文を以下コードに変更してみてはどうでしょうか?

Python

1def application(environ, start_response): 2 status = '200 OK' 3 output = b'Hello World!' 4 5 response_headers = [('Content-type', 'text/plain'), 6 ('Content-Length', str(len(output)))] 7 start_response(status, response_headers) 8 return [output]

■参考情報

投稿2018/01/19 17:56

編集2018/01/19 21:14
umyu

総合スコア5846

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問