0

我是一名新手 Web 开发人员,具有一定的编程背景(主要是 Python)。我正在寻找有关选择正确技术的一些基本建议。

我需要通过 Internet 提供文件(mp3),但我需要对访问进行一些控制: 1. 文件只能由授权用户访问。2. 我需要跟踪文件被加载的次数、由谁加载等。

实现这一点的最佳技术可能是什么?也就是说,我应该学习 Apache 还是 Django?或者别的什么?我正在寻找正确方向的“指针”。

感谢!R

4

2 回答 2

0

You could use Django and Lighttpd as a web server. With Lighttpd you can use mod_secdownload, wich enables you to generate one time only urls.

More info can be found here: http://redmine.lighttpd.net/projects/1/wiki/Docs_ModSecDownload

You can check for permissions in your Django (or any other) app and then redirect the user to this disposable URL if he passed the permission check.

于 2013-05-25T21:28:08.623 回答
0

如果您需要跟踪/控制表明 MP3 url 需要通过 Rails 控制器路由的下载。非常可行。此时,您可以运行检查、跟踪统计数据并将文件发回。

如果有很多 MP3,您不希望 Rails 实际发送 MP3 数据,因为这会浪费时间并占用一个实例。查看 xsendfile,Rails 可以在其中发送指示要发送的文件路径的响应标头,apache 将拦截它并进行实际发送。

https://tn123.org/mod_xsendfile/

http://rack.rubyforge.org/doc/classes/Rack/Sendfile.html

于 2013-05-25T18:28:19.307 回答