【发布时间】:2018-01-04 07:09:41
【问题描述】:
我正在尝试在 aws 中将我的 django 应用程序投入生产,我使用弹性 beanstalk 来部署它,以便创建 ec2 实例并将其连接到 rds 数据库 mysql 实例,并且我使用 amazon s3 存储中的存储桶来存储我的媒体文件。
当用户上传视频时,它在 s3 中存储为:“https://bucketname.s3.amazonaws.com/media/videos/videoname.mp4”。 在 django 开发模式下,我使用视频文件名作为批处理脚本的输入,该脚本将视频作为输出。
我在开发模式下的看法如下:
def get(request):
# get video
var = Video.objects.order_by('id').last()
v = '/home/myproject/media/videos/' + str(var)
# call process
subprocess.call("./step1.sh %s" % (str(v)), shell=True)
return render(request, 'endexecut.html')
在 aws(问题)的生产模式下,我尝试了:
v = 'https://bucketname.s3.amazonaws.com/media/videos/' + str(var)
但批处理不接受 url 作为处理的输入。
如何使用 s3 存储桶中的视频文件在我的视图中进行处理,如我所述?提前谢谢你。
【问题讨论】:
-
什么意思批处理不接受url ?
-
批处理将视频文件名作为输入,在开发模式下,视频位于文件系统上,所以我将视频的路径作为输入,但现在在 aws 上的 prod 模式下我没有'不知道如何处理存储在 s3 上的视频
标签: django amazon-web-services amazon-s3 amazon-ec2