質問編集履歴
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,7 +88,7 @@
|
|
88
88
|
|
89
89
|
###追記
|
90
90
|
|
91
|
-
ファイルそのものを移動してディレクトリを変更したが、以下のcontextsなるものを追記する必要があ
|
91
|
+
ファイルそのものを移動してディレクトリを変更したが、以下のcontextsなるものを追記する必要がありこの以下のURLだけでは使い方と意味がわからないので困っています。
|
92
92
|
|
93
93
|
http://flask-sqlalchemy.pocoo.org/2.3/contexts/
|
94
94
|
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -83,3 +83,67 @@
|
|
83
83
|
### 色々調査して試してみた結果、疑っていること
|
84
84
|
|
85
85
|
pythonコードそのものはちゃんと動くのでpytestで書かれたテストコードのフォルダのディレクトリがpythonコードが実行されるトップディレクトリ(mange.py)ではないため、エラーがでているのかなと推測しています。どのようにpythonコードが実行されるのと同じようにpytestも同じディレクトリで実行できるのかなーと困っています。恐らく、テストコードでとれるsql_pathは、.. /xxx/api/auth/auth.id.sqlという形になるのが正しいでのはと疑っています。この点どう思いますでしょうか?
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
###追記
|
90
|
+
|
91
|
+
ファイルそのものを移動してディレクトリを変更したが、以下のcontextsなるものを追記する必要があるが、この以下のURLだけでは使い方と意味がわかりません。
|
92
|
+
|
93
|
+
http://flask-sqlalchemy.pocoo.org/2.3/contexts/
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
```
|
100
|
+
|
101
|
+
self = <SQLAlchemy engine=None>, reference_app = None
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
def get_app(self, reference_app=None):
|
106
|
+
|
107
|
+
"""Helper method that implements the logic to look up an
|
108
|
+
|
109
|
+
application."""
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
if reference_app is not None:
|
114
|
+
|
115
|
+
return reference_app
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
if current_app:
|
120
|
+
|
121
|
+
return current_app._get_current_object()
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
if self.app is not None:
|
126
|
+
|
127
|
+
return self.app
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
raise RuntimeError(
|
132
|
+
|
133
|
+
> 'No application found. Either work inside a view function or push'
|
134
|
+
|
135
|
+
' an application context. See'
|
136
|
+
|
137
|
+
' http://flask-sqlalchemy.pocoo.org/contexts/.'
|
138
|
+
|
139
|
+
)
|
140
|
+
|
141
|
+
E RuntimeError: No application found. Either work inside a view function or push an application context. See http://flask-sqlalchemy.pocoo.org/contexts/.
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
../../../.pyenv/versions/3.6.5/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:912: RuntimeError
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
```
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
> f = open(sql_path)
|
16
16
|
|
17
|
-
E FileNotFoundError: [Errno 2] No such file or directory: 'xxx/
|
17
|
+
E FileNotFoundError: [Errno 2] No such file or directory: 'xxx/api/auth/auth.id.sql'
|
18
18
|
|
19
19
|
|
20
20
|
|