質問編集履歴
5
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,6 +38,4 @@
|
|
38
38
|
def init_app(app):
|
39
39
|
pass
|
40
40
|
|
41
|
-
```
|
41
|
+
```
|
42
|
-
|
43
|
-
stating.py及び、 production.pyはそれぞれ、環境ごとの環境変数がかかれている。
|
4
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,8 +6,9 @@
|
|
6
6
|
|
7
7
|
wsgi.py
|
8
8
|
```python
|
9
|
+
* create_appは、initファイルからimport
|
9
10
|
import os
|
10
|
-
from
|
11
|
+
from xxx import create_app
|
11
12
|
|
12
13
|
if os.environ.get("DEBUG"):
|
13
14
|
logging.basicConfig(level=logging.DEBUG)
|
3
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,4 +15,28 @@
|
|
15
15
|
if __name__ == '__main__':
|
16
16
|
app = create_app('test')
|
17
17
|
app.run(host='127.0.0.1', port=8080, debug=True)
|
18
|
-
```
|
18
|
+
```
|
19
|
+
|
20
|
+
追記
|
21
|
+
|
22
|
+
test.py(ローカルで動かす用のconfigファイル)
|
23
|
+
```
|
24
|
+
import os
|
25
|
+
from pathlib import Path
|
26
|
+
from module.config.base import Config
|
27
|
+
|
28
|
+
basedir = Path(__file__).parent.parent.parent
|
29
|
+
|
30
|
+
|
31
|
+
class LocalConfig(Config):
|
32
|
+
TESTING = True
|
33
|
+
DEBUG = True
|
34
|
+
SQLALCHEMY_DATABASE_URI = "sqlite:////" + os.path.join(basedir, "test.db")
|
35
|
+
|
36
|
+
@staticmethod
|
37
|
+
def init_app(app):
|
38
|
+
pass
|
39
|
+
|
40
|
+
```
|
41
|
+
|
42
|
+
stating.py及び、 production.pyはそれぞれ、環境ごとの環境変数がかかれている。
|
2
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
test.py/staging.py/production.pyのそれぞれ3つのconfigファイルがあります。
|
2
|
+
この三つの環境の違いは、year.pyはローカル環境、staging.pyはGAE環境、production.pyはGKE環境です。
|
2
3
|
下記のコードにどう追記していけば、これらのconfigの読み替えができるようしたいです。
|
3
4
|
現状、test.pyのconfigを読むように書いていますが、これを3つ増やすだけでは駄目だと思っています。
|
4
5
|
条件分岐か何かかくべきでしょうか? こうかけるというのがあれば、ご教示いただけませんでしょうか?
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
wsgi.py
|
7
7
|
```python
|
8
8
|
import os
|
9
|
-
from
|
9
|
+
from module import create_app
|
10
10
|
|
11
11
|
if os.environ.get("DEBUG"):
|
12
12
|
logging.basicConfig(level=logging.DEBUG)
|