相关疑难解决方法(0)

"pip install --user ..."的目的是什么?

来自pip install --help:

 --user      Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on
             Windows. (See the Python documentation for site.USER_BASE for full details.)
Run Code Online (Sandbox Code Playgroud)

site.USER_BASE的文档是一个令人讨厌的虫洞,有趣的*NIX主题,我不明白.

--user简明英语的目的是什么?为什么要将包裹装入~/.local/物质?为什么不在我的$ PATH中放置一个可执行文件?

python pip virtualenv python-3.x

132
推荐指数
7
解决办法
13万
查看次数

Django+gunicorn+nginx上传大文件502错误

问题

上传 1-2mb 文件工作正常。当我尝试上传 16mb 文件时,几秒钟后出现 502 错误

更详细:

  1. 我点击“上传”
  2. 谷歌浏览器上传文件(上传状态从左下角的 0% 变为 100%)
  3. 状态更改为“等待主机”,其中 HOST 是我的站点主机名
  4. 半分钟后服务器返回“502 Bad Gateway”

我的看法:

def upload(request):
    if request.method == 'POST':
        f = File(data=request.FILES['file'])
        f.save()
        return redirect(reverse(display),  f.id)
    else:
        return render('filehosting_upload.html', request)
Run Code Online (Sandbox Code Playgroud)

render(template, request [,data]) 是我自己的速记,用于处理一些 ajax 内容;

filehosting_upload.html

{% extends "base.html" %}
{% block content %}
    <h2>File upload</h2>
    <form action="{% url nexus.filehosting.views.upload %}" method="post" enctype="multipart/form-data">
        {% csrf_token %}
        <input type="file" name="file">
        <button type="submit" class="btn">Upload</button>
    </form>
{% endblock %}
Run Code Online (Sandbox Code Playgroud)

日志和规格

我在日志中找不到任何信息。

版本: …

django nginx gunicorn

7
推荐指数
1
解决办法
8098
查看次数

标签 统计

django ×1

gunicorn ×1

nginx ×1

pip ×1

python ×1

python-3.x ×1

virtualenv ×1