質問編集履歴

4

タグの追加

2021/03/21 00:48

投稿

dam9806
dam9806

スコア21

test CHANGED
File without changes
test CHANGED
File without changes

3

httpd.conf変更にかかる追記

2021/03/21 00:48

投稿

dam9806
dam9806

スコア21

test CHANGED
File without changes
test CHANGED
@@ -105,3 +105,65 @@
105
105
  application = get_wsgi_application()
106
106
 
107
107
  ```
108
+
109
+
110
+
111
+ 【追記】
112
+
113
+ 問題の原因と関係あるか分かりませんが、httpd.confに`WSGIPythonHome /usr/local/bin/python3.9`を追加したところ、以下のエラーログが吐かれました。
114
+
115
+ ```
116
+
117
+ Current thread 0x00000001132ad5c0 (most recent call first):
118
+
119
+ <no Python frame>
120
+
121
+ [Sun Mar 21 09:39:56.751669 2021] [wsgi:warn] [pid 79098] mod_wsgi (pid=79098): Python home /usr/local/bin/python3.9 is not a directory. Python interpreter may not be able to be initialized correctly. Verify the supplied path.
122
+
123
+ Python path configuration:
124
+
125
+ PYTHONHOME = '/usr/local/bin/python3.9'
126
+
127
+ PYTHONPATH = (not set)
128
+
129
+ program name = 'python3'
130
+
131
+ isolated = 0
132
+
133
+ environment = 1
134
+
135
+ user site = 1
136
+
137
+ import site = 1
138
+
139
+ sys._base_executable = '/usr/local/opt/httpd/bin/httpd'
140
+
141
+ sys.base_prefix = '/usr/local/bin/python3.9'
142
+
143
+ sys.base_exec_prefix = '/usr/local/bin/python3.9'
144
+
145
+ sys.platlibdir = 'lib'
146
+
147
+ sys.executable = '/usr/local/opt/httpd/bin/httpd'
148
+
149
+ sys.prefix = '/usr/local/bin/python3.9'
150
+
151
+ sys.exec_prefix = '/usr/local/bin/python3.9'
152
+
153
+ sys.path = [
154
+
155
+ '/usr/local/bin/python3.9/lib/python39.zip',
156
+
157
+ '/usr/local/bin/python3.9/lib/python3.9',
158
+
159
+ '/usr/local/bin/python3.9/lib/python3.9/lib-dynload',
160
+
161
+ ]
162
+
163
+ Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
164
+
165
+ Python runtime state: core initialized
166
+
167
+ ModuleNotFoundError: No module named 'encodings'
168
+
169
+ ```

2

wsgi.py内容の追加

2021/03/21 00:48

投稿

dam9806
dam9806

スコア21

test CHANGED
File without changes
test CHANGED
@@ -20,15 +20,19 @@
20
20
 
21
21
  ```
22
22
 
23
- 「No module named 'django'」と吐かれていますが、何をどう対処すば良いのか分かりません
23
+ 一番下に「No module named 'django'」と吐かれていますが、Tracebackで吐かるインポート対象パッケージ`django.core.wsgi`とモジュール`get_wsgi_application`が存在することは確認済みです
24
24
 
25
- なんとなく、PATH設定ミス・・・とも思ったりしますが、よく分かりません。
25
+ httpd.conf または wsgi.pyのPATH設定ミスのよう気がしますが、よく分かりません。
26
+
27
+
26
28
 
27
29
  考えられる解決策がありましたら教えてください。
28
30
 
31
+ 以下に、実行環境、httpd.conf、ログに吐かれているwsgi.pyの内容を載せておきます。
29
32
 
30
33
 
34
+
31
- 実行環境は以下のようになっています。
35
+ 実行環境
32
36
 
33
37
  Mojave 10.14.6
34
38
 
@@ -44,9 +48,13 @@
44
48
 
45
49
 
46
50
 
47
- また、httpd.confについて、デフォルトから以下のように変更しています。
51
+ httpd.conf
48
52
 
53
+ デフォルトから以下のように変更しています。
54
+
55
+ `WSGIPythonPath /Users/fuku/proj/study/django`のように変更して試したりもしましたが、症状は変わりませんでした。
56
+
49
- ```
57
+ ```httpd.conf
50
58
 
51
59
  (中略)
52
60
 
@@ -71,3 +79,29 @@
71
79
  </Directory>
72
80
 
73
81
  ```
82
+
83
+
84
+
85
+ ◆wsgi.py
86
+
87
+ /Users/fuku/proj/study/django/quick_django/quick_django/wsgi.pyの内容は以下です。
88
+
89
+ コメントでaddと付している行は、デフォルトから追加したものになります。
90
+
91
+ ```python
92
+
93
+ import os
94
+
95
+ import sys # add
96
+
97
+
98
+
99
+ sys.path.append('/User/fuku/proj/study/django') # add
100
+
101
+ from django.core.wsgi import get_wsgi_application
102
+
103
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'quick_django.settings')
104
+
105
+ application = get_wsgi_application()
106
+
107
+ ```

1

指摘事項の対応(stydy→study)

2021/03/20 23:24

投稿

dam9806
dam9806

スコア21

test CHANGED
File without changes
test CHANGED
@@ -54,7 +54,7 @@
54
54
 
55
55
  (中略)
56
56
 
57
- LoadModule wsgi_module /Users/fuku/proj/stydy/django/lib/python3.9/site-packages/mod_wsgi/server/mod_wsgi-py39.cpython-39-darwin.so
57
+ LoadModule wsgi_module /Users/fuku/proj/study/django/lib/python3.9/site-packages/mod_wsgi/server/mod_wsgi-py39.cpython-39-darwin.so
58
58
 
59
59
  WSGIScriptAlias / /Users/fuku/proj/study/django/quick_django/quick_django/wsgi.py
60
60