質問編集履歴
2
該当のソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,210 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
### 本プロジェクト(docker-compose)の構成
|
26
|
+
|
27
|
+
django
|
28
|
+
|
29
|
+
├── docker-compose.yml
|
30
|
+
|
31
|
+
├── mysql
|
32
|
+
|
33
|
+
├── sql
|
34
|
+
|
35
|
+
├── nginx
|
36
|
+
|
37
|
+
│ ├── conf
|
38
|
+
|
39
|
+
│ │ └── app_nginx.conf
|
40
|
+
|
41
|
+
│ └── uwsgi_params
|
42
|
+
|
43
|
+
└── python
|
44
|
+
|
45
|
+
├── Dockerfile
|
46
|
+
|
47
|
+
└── requirements.txt
|
48
|
+
|
49
|
+
### 該当のソースコード
|
50
|
+
|
51
|
+
```docker
|
52
|
+
|
53
|
+
#docker-compose.yml
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
version : "3.4"
|
58
|
+
|
59
|
+
services:
|
60
|
+
|
61
|
+
db:
|
62
|
+
|
63
|
+
image: mariadb
|
64
|
+
|
65
|
+
restart: always
|
66
|
+
|
67
|
+
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
68
|
+
|
69
|
+
ports:
|
70
|
+
|
71
|
+
- 3308:3306
|
72
|
+
|
73
|
+
volumes:
|
74
|
+
|
75
|
+
- ./docker/mysql/conf.d:/etc/mysql/conf.d
|
76
|
+
|
77
|
+
- ./log/mysql:/var/log/mysql
|
78
|
+
|
79
|
+
environment:
|
80
|
+
|
81
|
+
- MYSQL_ROOT_PASSWORD=1126
|
82
|
+
|
83
|
+
- MYSQL_DATABASE=testdb
|
84
|
+
|
85
|
+
- MYSQL_USER=maria
|
86
|
+
|
87
|
+
- MYSQL_PASSWORD=1126
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
python:
|
92
|
+
|
93
|
+
build: python
|
94
|
+
|
95
|
+
command: uwsgi --socket :8001 --module mysite.wsgi --py-autoreload 1 --logto /tmp/mylog.log
|
96
|
+
|
97
|
+
volumes:
|
98
|
+
|
99
|
+
- ./src:/code
|
100
|
+
|
101
|
+
- ./static:/static
|
102
|
+
|
103
|
+
expose:
|
104
|
+
|
105
|
+
- "8001"
|
106
|
+
|
107
|
+
depends_on:
|
108
|
+
|
109
|
+
- db
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
nginx:
|
114
|
+
|
115
|
+
image: nginx:1.13
|
116
|
+
|
117
|
+
ports:
|
118
|
+
|
119
|
+
- "8000:8000"
|
120
|
+
|
121
|
+
volumes:
|
122
|
+
|
123
|
+
- ./nginx/conf:/etc/nginx/conf.d
|
124
|
+
|
125
|
+
- ./nginx/uwsgi_params:/etc/nginx/uwsgi_params
|
126
|
+
|
127
|
+
- ./static:/static
|
128
|
+
|
129
|
+
depends_on:
|
130
|
+
|
131
|
+
- python
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
```uwsgi
|
136
|
+
|
137
|
+
'''呪文'''
|
138
|
+
|
139
|
+
uwsgi_param QUERY_STRING $query_string;
|
140
|
+
|
141
|
+
uwsgi_param REQUEST_METHOD $request_method;
|
142
|
+
|
143
|
+
uwsgi_param CONTENT_TYPE $content_type;
|
144
|
+
|
145
|
+
uwsgi_param CONTENT_LENGTH $content_length;
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
uwsgi_param REQUEST_URI $request_uri;
|
150
|
+
|
151
|
+
uwsgi_param PATH_INFO $document_uri;
|
152
|
+
|
153
|
+
uwsgi_param DOCUMENT_ROOT $document_root;
|
154
|
+
|
155
|
+
uwsgi_param SERVER_PROTOCOL $server_protocol;
|
156
|
+
|
157
|
+
uwsgi_param REQUEST_SCHEME $scheme;
|
158
|
+
|
159
|
+
uwsgi_param HTTPS $https if_not_empty;
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
uwsgi_param REMOTE_ADDR $remote_addr;
|
164
|
+
|
165
|
+
uwsgi_param REMOTE_PORT $remote_port;
|
166
|
+
|
167
|
+
uwsgi_param SERVER_PORT $server_port;
|
168
|
+
|
169
|
+
uwsgi_param SERVER_NAME $server_name;
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
```conf
|
176
|
+
|
177
|
+
#nginx/conf/app_nginx.conf
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
upstream django {
|
182
|
+
|
183
|
+
ip_hash;
|
184
|
+
|
185
|
+
server python:8001;
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
server {
|
192
|
+
|
193
|
+
listen 8000;
|
194
|
+
|
195
|
+
server_name 127.0.0.1;
|
196
|
+
|
197
|
+
charset utf-8;
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
location /static {
|
202
|
+
|
203
|
+
alias /static;
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
location / {
|
210
|
+
|
211
|
+
uwsgi_pass django;
|
212
|
+
|
213
|
+
include /etc/nginx/uwsgi_params;
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
server_tokens off;
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
```
|
226
|
+
|
227
|
+
|
228
|
+
|
25
229
|
|
26
230
|
|
27
231
|
### 補足情報(FW/ツールのバージョンなど)
|
1
試した事を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -33,3 +33,9 @@
|
|
33
33
|
django3.1
|
34
34
|
|
35
35
|
mariadb10.4.8
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
nginxがのバージョンが古い事をしったので、
|
40
|
+
|
41
|
+
最新のものにバージョンアップしたのですがそれでも問題は解決しませんでした。
|