質問編集履歴
3
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -108,9 +108,11 @@
|
|
108
108
|
|
109
109
|
sys.path.append('/Users/Jun/PycharmProjects/goscrapy')
|
110
110
|
|
111
|
-
だと上手くいくのですが、それ以外だと上手くデプロイできません。
|
112
|
-
|
113
|
-
す
|
111
|
+
だと上手くいきます。スクレイピングもできます。
|
112
|
+
|
113
|
+
それ以外だと上手くできません。
|
114
|
+
|
115
|
+
|
114
116
|
|
115
117
|
|
116
118
|
|
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -91,3 +91,131 @@
|
|
91
91
|
なにか勘違いしているのでしょうか?
|
92
92
|
|
93
93
|
よろしくお願いいたします。
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
###追記 なにをしたいのか
|
100
|
+
|
101
|
+
scrapyをdjangoから操作したいので
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
[How to use Scrapy with Django Application](https://medium.com/@ali_oguzhan/how-to-use-scrapy-with-django-application-c16fabd0e62e)
|
106
|
+
|
107
|
+
こちらを参考にしているのですが、scrapyをデーモン化するscrapydにscrapyをデプロイする際に
|
108
|
+
|
109
|
+
sys.path.append('/Users/Jun/PycharmProjects/goscrapy')
|
110
|
+
|
111
|
+
だと上手くいくのですが、それ以外だと上手くデプロイできません。
|
112
|
+
|
113
|
+
すでにデプロイしてスクレイピングも出来ています。
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
参考サイトの表記方法
|
118
|
+
|
119
|
+
scrapy_app/settings.py
|
120
|
+
|
121
|
+
```ここに言語を入力
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
import os
|
126
|
+
|
127
|
+
import sys
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
# DJANGO INTEGRATION
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
sys.path.append(os.path.dirname(os.path.abspath('.')))
|
136
|
+
|
137
|
+
# Do not forget the change iCrawler part based on your project name
|
138
|
+
|
139
|
+
os.environ['DJANGO_SETTINGS_MODULE'] = 'iCrawler.settings'
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
# This is required only if Django Version > 1.8
|
144
|
+
|
145
|
+
import django
|
146
|
+
|
147
|
+
django.setup()
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
# DJANGO INTEGRATION
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
## Rest of settings are below ...
|
156
|
+
|
157
|
+
```
|
158
|
+
|
159
|
+
### エラーの表示
|
160
|
+
|
161
|
+
```ここに言語を入力
|
162
|
+
|
163
|
+
(goscrapy) C:\Users\Jun\PycharmProjects\goscrapy\apps\scrapy_app>scrapyd-deploy
|
164
|
+
|
165
|
+
Packing version 1533502405
|
166
|
+
|
167
|
+
Deploying to project "scrapy_app" in http://127.0.0.1:6800/addversion.json
|
168
|
+
|
169
|
+
Server response (200):
|
170
|
+
|
171
|
+
{"node_name": "DESKTOP-DJ3BDQ4", "status": "error", "message": "Traceback (most recent call last):\r\n File \"c:\users\jun\anaconda3\envs\
|
172
|
+
|
173
|
+
goscrapy\lib\runpy.py\", line 193, in _run_module_as_main\r\n \"__main__\", mod_spec)\r\n File \"c:\users\jun\anaconda3\envs\goscrapy
|
174
|
+
|
175
|
+
\lib\runpy.py\", line 85, in _run_code\r\n exec(code, run_globals)\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\site-package
|
176
|
+
|
177
|
+
s\scrapyd\runner.py\", line 40, in <module>\r\n main()\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\site-packages\scrapyd\
|
178
|
+
|
179
|
+
runner.py\", line 37, in main\r\n execute()\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\site-packages\scrapy\cmdline.py\",
|
180
|
+
|
181
|
+
line 110, in execute\r\n settings = get_project_settings()\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\site-packages\scrapy\
|
182
|
+
|
183
|
+
\utils\project.py\", line 68, in get_project_settings\r\n settings.setmodule(settings_module_path, priority='project')\r\n File \"c:\users
|
184
|
+
|
185
|
+
\jun\anaconda3\envs\goscrapy\lib\site-packages\scrapy\settings\__init__.py\", line 292, in setmodule\r\n module = import_module(modu
|
186
|
+
|
187
|
+
le)\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\importlib\__init__.py\", line 126, in import_module\r\n return _bootstrap._g
|
188
|
+
|
189
|
+
cd_import(name[level:], package, level)\r\n File \"<frozen importlib._bootstrap>\", line 994, in _gcd_import\r\n File \"<frozen importlib._boo
|
190
|
+
|
191
|
+
tstrap>\", line 971, in _find_and_load\r\n File \"<frozen importlib._bootstrap>\", line 955, in _find_and_load_unlocked\r\n File \"<frozen imp
|
192
|
+
|
193
|
+
ortlib._bootstrap>\", line 665, in _load_unlocked\r\n File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\r\n File \"<fr
|
194
|
+
|
195
|
+
ozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\r\n File \"C:\Users\Jun\PycharmProjects\goscrapy\apps\scrapy_app\sc
|
196
|
+
|
197
|
+
rapy_app\settings.py\", line 26, in <module>\r\n django.setup()\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\site-packages\d
|
198
|
+
|
199
|
+
jango\__init__.py\", line 19, in setup\r\n configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r\n File \"c:\users\jun\anaconda
|
200
|
+
|
201
|
+
3\envs\goscrapy\lib\site-packages\django\conf\__init__.py\", line 56, in __getattr__\r\n self._setup(name)\r\n File \"c:\users\jun\
|
202
|
+
|
203
|
+
\anaconda3\envs\goscrapy\lib\site-packages\django\conf\__init__.py\", line 43, in _setup\r\n self._wrapped = Settings(settings_module)
|
204
|
+
|
205
|
+
\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\site-packages\django\conf\__init__.py\", line 106, in __init__\r\n mod = impo
|
206
|
+
|
207
|
+
rtlib.import_module(self.SETTINGS_MODULE)\r\n File \"c:\users\jun\anaconda3\envs\goscrapy\lib\importlib\__init__.py\", line 126, in imp
|
208
|
+
|
209
|
+
ort_module\r\n return _bootstrap._gcd_import(name[level:], package, level)\r\n File \"<frozen importlib._bootstrap>\", line 994, in _gcd_imp
|
210
|
+
|
211
|
+
ort\r\n File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\r\n File \"<frozen importlib._bootstrap>\", line 941, in _find_and
|
212
|
+
|
213
|
+
_load_unlocked\r\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\r\n File \"<frozen importlib._bootstrap>\",
|
214
|
+
|
215
|
+
line 994, in _gcd_import\r\n File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\r\n File \"<frozen importlib._bootstrap>\", l
|
216
|
+
|
217
|
+
ine 953, in _find_and_load_unlocked\r\nModuleNotFoundError: No module named 'config'\r\n"}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
```
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
windows10
|
2
|
+
|
3
|
+
django 2.0.5
|
4
|
+
|
5
|
+
|
6
|
+
|
1
7
|
同じプロジェクト内でdjangoとscrapyを使用しています。
|
2
8
|
|
3
9
|
djangoのmodelなどにscrapyから接続するのにscrapyのsettings.pyに下記のコード書いています。
|