我在 heroku 上有一个 python/django 服务器,这是我的索引方法:
def index(request):
youtube_dl.main(['https://www.youtube.com/watch?v=ufERJEdcfAY'])
return HttpResponse('hello')
当我转到我的主页时,响应是预期的“你好”,但我在服务器的任何地方都找不到媒体文件
我还有另一个主脚本:
if __name__ == '__main__':
youtube_dl.main(['https://www.youtube.com/watch?v=ufERJEdcfAY'])
当我运行时,python __main__.py
一切正常,文件被下载到我运行命令的文件夹中。
任何想法都将受到高度欢迎,问候!
编辑
我尝试了踩踏,它似乎正在工作,但我找不到文件。我heroku run bash
试图找到文件所在的目录,但找不到。
←[32m2015-03-27T11:53:42.068905+00:00 heroku[api]:←[0m Deploy a5bebbc by qobyyy@
gmail.com
←[32m2015-03-27T11:53:42.068905+00:00 heroku[api]:←[0m Release v44 created by qo
byyy@gmail.com
←[36m2015-03-27T11:53:42.880957+00:00 heroku[web.1]:←[0m State changed from up t
o starting
←[36m2015-03-27T11:53:45.526784+00:00 heroku[web.1]:←[0m Stopping all processes
with SIGTERM
←[36m2015-03-27T11:53:46.281281+00:00 app[web.1]:←[0m 2015-03-27 11:53:46 [3] [I
NFO] Shutting down: Master
←[36m2015-03-27T11:53:46.262444+00:00 app[web.1]:←[0m 2015-03-27 11:53:46 [10] [
INFO] Worker exiting (pid: 10)
←[36m2015-03-27T11:53:46.262449+00:00 app[web.1]:←[0m 2015-03-27 11:53:46 [9] [I
NFO] Worker exiting (pid: 9)
←[36m2015-03-27T11:53:46.263200+00:00 app[web.1]:←[0m 2015-03-27 11:53:46 [3] [I
NFO] Handling signal: term
←[36m2015-03-27T11:53:46.868377+00:00 heroku[web.1]:←[0m Starting process with c
ommand `gunicorn gettingstarted.wsgi --log-file -`
←[36m2015-03-27T11:53:47.009560+00:00 heroku[web.1]:←[0m Process exited with sta
tus 0
←[36m2015-03-27T11:53:48.660418+00:00 app[web.1]:←[0m 2015-03-27 11:53:48 [3] [I
NFO] Listening at: http://0.0.0.0:52428 (3)
←[36m2015-03-27T11:53:48.660502+00:00 app[web.1]:←[0m 2015-03-27 11:53:48 [3] [I
NFO] Using worker: sync
←[36m2015-03-27T11:53:48.669618+00:00 app[web.1]:←[0m 2015-03-27 11:53:48 [9] [I
NFO] Booting worker with pid: 9
←[36m2015-03-27T11:53:48.659633+00:00 app[web.1]:←[0m 2015-03-27 11:53:48 [3] [I
NFO] Starting gunicorn 19.0.0
←[36m2015-03-27T11:53:48.711500+00:00 app[web.1]:←[0m 2015-03-27 11:53:48 [10] [
INFO] Booting worker with pid: 10
←[36m2015-03-27T11:53:49.101270+00:00 heroku[web.1]:←[0m State changed from star
ting to up
←[33m2015-03-27T11:53:50.392891+00:00 heroku[router]:←[0m at=info method=GET pat
h="/" host=rocky-castle-8297.herokuapp.com request_id=0ad1d01d-174e-439c-b91d-2c
4487920d97 fwd="85.250.225.100" dyno=web.1 connect=1ms service=785ms status=200
bytes=213
←[36m2015-03-27T11:53:50.793930+00:00 app[web.1]:←[0m [youtube] ufERJEdcfAY: Dow
nloading webpage
←[36m2015-03-27T11:53:51.015179+00:00 app[web.1]:←[0m [youtube] ufERJEdcfAY: Ext
racting video information
←[36m2015-03-27T11:53:51.068767+00:00 app[web.1]:←[0m [youtube] ufERJEdcfAY: Dow
nloading js player en_US-vflFAPa9H
←[36m2015-03-27T11:53:51.349748+00:00 app[web.1]:←[0m [youtube] ufERJEdcfAY: Dow
nloading DASH manifest
←[36m2015-03-27T11:53:51.477715+00:00 app[web.1]:←[0m [download] Destination: Pi
xies - - Where Is My Mind-ufERJEdcfAY.mp4
[download] 100% of 8.70MiB in 00:0059MiB/s ETA 00:00known ETA