PyOne2.0更新-更方便的验证方式&支持多种视频格式播放

PyOne喜迎2.0版本:

  1. 验证方式更方便、更快捷
  2. 支持个人版账号,同时不再支持世纪互联版账号
  3. 支持avi、wmv等格式视频播放

PyOne介绍

  1. onedrive列表程序,可用于更好的分享文件
  2. 基于Flask开发,Python是最好的语言demo展示:https://pyone.me (别问我密码)

安装前提

  1. 只支持onedrive商业版、教育版、个人版,不再支持世纪互联版
  2. 涉及的东西较多,不熟悉linux操作但是想安装的,多操作几遍

升级教程

  • 如果是1.0版本升级2.0,那么直接重新安装
  • 如果是小版本更新,则可以按照以下流程进行更新代码
    • 先将data目录和config.py复制出去
    • 删除原来的PyOne源码
    • 重新git clone一份PyOne源码
    • 将原来的data目录替换新源码的data目录,原来的config.py替换新源码的config.py
    • 重新安装依赖,看是否有新增的依赖包: pip install -r requirements.txt
    • 重启网站: supervisorctl -c supervisord.conf restart pyone
    • 最好更新一下文件缓存: python function.py UpdateFile

安装教程

1. 准备工作

环境要求:centos7+python2.7安装宝塔面板:http://bt.cn在宝塔面板安装:redis、mongodb、nginx源码下载到本地:

git clone https://github.com/abbeyokgo/PyOne

修改源码下的config.py文件:

修改config_dir为当前源码目录绝对路径

2. 开始安装

  • 安装依赖环境:
cd PyOne && wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py && pip install -r requirements.txt
  • 试运行,在源码根目录下运行
gunicorn -k eventlet -b 0.0.0.0:34567 run:app

然后试着访问:http://ip:34567 看看能正常显示?如果不能,请在宝塔开启端口,还不行请看错误内容

  • 修改nginx配置

假设你已经将域名解析到你的服务器了,然后在宝塔添加了域名,那么只需要在宝塔修改nginx配置

网站管理-点击域名-反向代理,反向代理:http://127.0.0.1:34567

TIM截图20180913191350.png

保存之后,应该就可以通过域名访问了

注意!为了后台功能的正常使用,反向代理之后,需要修改nginx配置

如图,添加两行,再保存

location / 
    {
        ...

        proxy_buffering off;
          proxy_cache off;

        ...
    }

TIM截图20180913191714.png

  • 授权

紧接着上一步,就能直接授权了

1.png 2.png 3.png 4.png

3. 配置开机启动

网站源码下有个 supervisord.conf,主要内容如下:

[program:pyone]
command = gunicorn -k eventlet -b 0.0.0.0:34567 run:app
directory = /root/pyone
autorestart = true

主要修改两个地方:

  1. 端口号:即34567那个端口号,修改为自己选的,或者不改动
  2. 源码目录:directory修改为你选的网站目录

修改之后运行下面的命令,设置开机启动

echo "supervisord -c 源码目录/supervisord.conf" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

重启生效。

本次不用重启生效的方法:

supervisord -c 源码目录/supervisord.conf

高级使用

带你玩转PyOne:onedrive列表工具(二、使用篇)

带你玩转PyOne:onedrive列表工具(三、后台管理篇)

提供安装服务

点击购买

本文作者:Abbey

本文链接:https://www.abbeyok.com/archives/70

版权声明:本博客所有文章除特别声明外,均采用CC BY-NC-SA 3.0许可协议。转载请注明出处!

【开源】基于有赞开发的要饭系统... <<
44 条评论
  1. author
    2018-10-29
    木头

    如何寻求付费帮助,无法绑定账号,获取code

  2. author
    2018-10-29
    呵呵哒
    2018-10-29
    Abbey
    看后台什么错误。检查mongodb、re...

    后台是这个错误

    [2018-10-29 22:23:58,771] ERROR in app: Exception on / [GET]
    Traceback (most recent call last):
    File “/usr/lib64/python2.7/site-packages/flask/app.py”, line 2292, in wsgi_app
    response = self.full_dispatch_request()
    File “/usr/lib64/python2.7/site-packages/flask/app.py”, line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File “/usr/lib64/python2.7/site-packages/flask/app.py”, line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
    File “/usr/lib64/python2.7/site-packages/flask/app.py”, line 1813, in full_dispatch_request
    rv = self.dispatch_request()
    File “/usr/lib64/python2.7/site-packages/flask/app.py”, line 1799, in dispatch_request
    return self.view_functionsrule.endpoint
    File “/usr/lib64/python2.7/site-packages/flask_limiter/extension.py”, line 544, in __inner

  3. author
    2018-10-29
    呵呵哒

    [2018-10-29 22:23:58,771] ERROR in app: Exception on / [GET]
    Traceback (most recent call last):
    File "/usr/lib64/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
    File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
    File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
    File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functionsrule.endpoint
    File "/usr/lib64/python2.7/site-packages/flask_limiter/extension.py", line 544, in inner
    return obj(a, *k)
    File "/root/PyOne/run.py", line 376, in index
    if items.count()==0:
    File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 1766, in count
    return self._count(cmd, collation, session)
    File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 1563, in _count
    with self._socket_for_reads(session) as (sock_info, slave_ok):
    File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter

    return self.gen.next()
    File "/usr/lib64/python2.7/site-packages/pymongo/mongo_client.py", line 1099, in _socket_for_reads
    server = topology.select_server(read_preference)
    File "/usr/lib64/python2.7/site-packages/pymongo/topology.py", line 224, in select_server
    address))
    File "/usr/lib64/python2.7/site-packages/pymongo/topology.py", line 183, in select_servers
    selector, server_timeout, address)
    File "/usr/lib64/python2.7/site-packages/pymongo/topology.py", line 199, in _select_servers_loop
    self._error_message(selector))
    ServerSelectionTimeoutError: localhost:27017: [Errno 111] ECONNREFUSED

  4. author
    2018-10-29
    Abbey
    2018-10-29
    呵呵哒
    Internal Server Erro...

    看后台什么错误。检查mongodb、redis安装运行没有

  5. author
    2018-10-29
    呵呵哒

    Internal Server Error
    The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

    换了两台机子都这样,一台256M,一台512M,centos7+宝塔

  6. author
    2018-10-29
    大熊
    2018-10-29
    苏寅
    cpu使用率一直是100%这个问题,我让...

    你这种无脑伸手党真是伤大佬的心!

  7. author
    2018-10-29
    Abbey
    2018-10-29
    眷恋
    大佬,个人版绑定账号显示Microsof...

    都重新走一遍流程,一遍不行就是第二遍

  8. author
    2018-10-29
    Abbey
    2018-10-29
    苏寅
    那你到是解释为啥cpu会一直占用100%...

    你这种小学生不懂就不要在这里丢人现眼了,我也懒得跟你解释,趁早重装系统回去写作业

  9. author
    2018-10-29
    苏寅
    2018-10-29
    Abbey
    代码就在那,有没有后门自己检测,自己带点...

    那你到是解释为啥cpu会一直占用100%,而且还不是我一个人的问题!别说这才跑了一个程序就占用100%,就算跑5个程序也不应该占用100%!

  10. author
    2018-10-29
    眷恋

    大佬,个人版绑定账号显示Microsoft account is experiencing technical problems. Please try again later. 教育版显示AADSTS50011: No reply address is registered for the application.都无法正常绑定,是哪里出现了问题么,教育版是自己学校的,是不是没开放权限,谢谢了。

请先登陆注册

已登录,注销 取消