文件共享Web应用程序

pleaseshare的Python项目详细描述


Pleashare是一个文件共享网站,旨在分散 通过使用BitTorrent、DHT和WebSeeds进行文件共享。

演示实例位于share.jeproteste.info

开始

gitoriousgithubmy own git server检索项目:

$ git clone git://gitorious.org/pleaseshare/pleaseshare.git

然后安装依赖项(假设您使用的是virtualenv):

$ cd pleaseshare
$ pip install -r requirements.txt

您还需要python 3.4

在此之后,您可以开始编码、测试、翻译(有关详细信息,请参见本页底部部分)等。

安装

(在那之前做“开始”的事情)

首先,将pleaseshare/default_settings.py文件复制到pleaseshare/local_settings.cfg 然后根据你的需要进行编辑。或者,可以设置$PLEASESHARE_CONFIG 环境变量到配置文件的绝对路径(如果local_settings.cfg文件 但是,它仍然会覆盖它。每一个选择都是有目的的, 您必须考虑更改以下内容:

  • SECRET_KEYWTF_CSRF_SECRET_KEY,都设置为本地key变量的值
  • SQLALCHEMY_DATABASE_URI用于数据库连接设置
  • ^ TT9}$最大上传文件大小

设置好所有内容后,您只需创建数据库即可:

$ ./make_db.py

为了部署pleashare,您可以沿着烧瓶deployment guide

我最喜欢的部署选项是带nginx或lighttpd的uwsgi。

示例uwsgi+nginx部署

uwsgi.ini文件:

[uwsgi]
socket = 127.0.0.1:4444
master = true
plugin = python3
chdir = /home/flask/pleaseshare/
module = pleaseshare:app
processes = 4

nginx配置部分:

server {
    listen                  80;
    server_name             share.example.com;
    client_max_body_size    50m;

    location / {
        include             uwsgi_params;
        uwsgi_pass          127.0.0.1:4444;
    }
}

server {
    listen                  80;
    server_name             files.example.com;

    location / {
        root                /home/flask/pleaseshare/uploads/;
        autoindex           off;
    }
}

(假设UPLOAD_FOLDER设置为"uploads",并且UPLOADED_FILES_URL"http://files.example.com/"

我通常还使用supervisord来管理我的python web应用程序:

[program:share]
command=uwsgi uwsgi.ini
directory=/home/flask/pleaseshare/
user=flask
redirect_stderr=true
autostart=true
autorestart=true

但是手动运行uwsgi uwsgi.ini也可以。

其他

关于webseed工作方式的一些指示可能是有序的。

  • 当Torrent只有一个文件时,就很容易了:WebSeed是文件的完整URL。
  • 当Torrent是多文件时,webseed url是父目录的url(我指的是Pleashare中的Torrent,它总是包含在以存档名命名的父目录中)。

例如,您上传一个toto.tar.gz存档,您将拥有一个类似/view/48a3-[…]/, 包含“toto”目录,该目录将包含存档文件中的文件。

webseed url应该不是包含“toto”目录,而是父目录 当然,文件索引应该被禁用,或者文件生成。 Web服务器可能会导致某些Torrent客户端出现问题。

所以假设你想用你的个人资料在Torrent中添加一个源 webserver(同样适用于to to.tar.gz Torrent),您必须放置一些东西 就像网页一样:http://my.example.com/uploads/它将包含一个toto 目录。

报告错误

到目前为止,还没有可用的公共bug跟踪器,但是您可以来报告bug或者说一句好话,或者 两个在xmpp聊天室share@chat.jeproteste.info。你也可以发邮件给我 pleaseshare@mathieui.net

许可证

请按照GNU Affero General Public License v3的条款发布。

Pleaseshare还包含来自Deluge torrent client的一些文件, 在GNU General Public Licence v3授权下。

贡献者

  • Mathieui-主要开发人员
  • cynddl-界面设计魔术
  • kaliko-修复

翻译注意事项

pybabel目前是broken on python 3.4,因此您需要用以下命令修补babel 1.3:

diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py
index 144bc98..94e09e9 100755
--- a/babel/messages/frontend.py
+++ b/babel/messages/frontend.py
@@ -128,7 +128,7 @@ class compile_catalog(Command):

         for idx, (locale, po_file) in enumerate(po_files):
             mo_file = mo_files[idx]
-            infile = open(po_file, 'r')
+            infile = open(po_file, 'rb')
             try:
                 catalog = read_po(infile, locale)
             finally:
@@ -439,7 +439,7 @@ class init_catalog(Command):
         log.info('creating catalog %r based on %r', self.output_file,
                  self.input_file)

-        infile = open(self.input_file, 'r')
+        infile = open(self.input_file, 'rb')
         try:
             # Although reading from the catalog template, read_po must be fed
             # the locale in order to correctly calculate plurals
@@ -554,7 +554,7 @@ class update_catalog(Command):
         if not domain:
             domain = os.path.splitext(os.path.basename(self.input_file))[0]

-        infile = open(self.input_file, 'U')
+        infile = open(self.input_file, 'rb')
         try:
             template = read_po(infile)
         finally:
@@ -566,7 +566,7 @@ class update_catalog(Command):
         for locale, filename in po_files:
             log.info('updating catalog %r based on %r', filename,
                      self.input_file)
-            infile = open(filename, 'U')
+            infile = open(filename, 'rb')
             try:
                 catalog = read_po(infile, locale=locale, domain=domain)
             finally:
@@ -577,7 +577,7 @@ class update_catalog(Command):
             tmpname = os.path.join(os.path.dirname(filename),
                                    tempfile.gettempprefix() +
                                    os.path.basename(filename))
-            tmpfile = open(tmpname, 'w')
+            tmpfile = open(tmpname, 'wb')
             try:
                 try:
                     write_po(tmpfile, catalog,
@@ -760,7 +760,7 @@ class CommandLineInterface(object):

         for idx, (locale, po_file) in enumerate(po_files):
             mo_file = mo_files[idx]
-            infile = open(po_file, 'r')
+            infile = open(po_file, 'rb')
             try:
                 catalog = read_po(infile, locale)
             finally:
@@ -1121,7 +1121,7 @@ class CommandLineInterface(object):
             tmpname = os.path.join(os.path.dirname(filename),
                                    tempfile.gettempprefix() +
                                    os.path.basename(filename))
-            tmpfile = open(tmpname, 'w')
+            tmpfile = open(tmpname, 'wb')
             try:
                 try:
                     write_po(tmpfile, catalog,

之后,您应该能够运行make trans来提取/更新 翻译和make compiletrans以生成最新的.mo文件。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在Spring Boot中从CrudePository访问表的几列   biginteger如何将Java long转换为*无符号*baseX字符串(以及返回)?   NetBeans“方法”颜色的java深色主题不起作用   位操作如何在位集JAVA中左右移动位?   java如何在Spring Boot中调用函数后释放所有缓存数据   java如何在IntelliJ中调试子进程?   使用Jersey API处理java文件上传和缓冲内部   java如何在安卓上显示通知?   java如何使用mybatis 3传递动态字段和值   java第三方API在多模块Maven项目中看不到类   如何使用java在SQLServer2005中存储日期   java确实需要接口指针来提供多个版本的JNI函数表吗   java我的希伯来语文本在iText中是左对齐的   java在清单的java选项中配置密钥库。yml在铸造PCF中的应用