我已经创建了测试存储库:https : //github.com/Labutin/CompareBranches 让我们尝试克隆和比较两个分支 branch_01 和 branch_02
$ git clone https://github.com/Labutin/CompareBranches.git
Cloning into 'CompareBranches'...
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
$ git diff remotes/origin/branch_01..remotes/origin/branch_02 --exit-code
$ echo $?
0
Run Code Online (Sandbox Code Playgroud)
所以,我们有两个相同的分支。
但是,如果我尝试使用 Web UI 来比较两个分支https://github.com/Labutin/CompareBranches/compare/branch_01...branch_02,它会显示 1 个文件已更改。为什么?Web UI 有什么问题?也许我必须修改网址?
非常简单的python示例:
import requests
c = requests.get(u'https://boxfwd.com').content
print c
Run Code Online (Sandbox Code Playgroud)
在我的本地计算机上一切正常。
但是在服务器上我看到这个错误:
requests.exceptions.SSLError: hostname 'boxfwd.com' doesn't match either of 'nycmsk.com', 'www.nycmsk.com'
Run Code Online (Sandbox Code Playgroud)
为什么我在服务器上看到这个错误?
我们的 Web 项目有非常奇怪的问题。
我们用:
2 Intel(R) Xeon(R) CPU E5520 @ 2.27GHz
12 GB 内存
我们每秒大约有 20 次点击。每秒 4-5 个请求很重——这是一个搜索请求。
我们使用 nginx + php-fpm (5.3.22)
安装在另一台机器上的 MySQL 服务器。
大多数情况下,我们的平均负载低于 10,CPU 使用率约为 50%
有时我们的 CPU 使用率约为 95%,之后平均负载增长到 50 甚至更多!!!
你可以在这里看到负载平均和 CPU 使用率(我在这里发送图像的声誉很低)
负载平均
CPU 使用率
我们必须重新加载 php-fpm ( /etc/init.d/php-fpm reload ) 以使情况正常化。
这可能每天发生 4-5 次。
我尝试使用 strace 来检查这种情况。
对不起,长日志!命令 strace -cp PID
PID – 的输出是随机的 php-fpm 进程 ID(我们启动 100 个 php-fpm 进程)。
这两个导致CPU使用率高的时刻。
Process 17272 attached - interrupt to quit
Process 17272 …Run Code Online (Sandbox Code Playgroud) 我开发多语言网站。页面的 URI 如下所示:
/RU/about
/EN/about
/IT/about
/JP/about
/EN/contacts
Run Code Online (Sandbox Code Playgroud)
在 jinja2 模板中我写道:
<a href="{{ url_for('about', lang_code=g.current_lang) }}">About</a>
Run Code Online (Sandbox Code Playgroud)
我必须在所有url_for调用中编写 lang_code=g.current_lang 。
是否可以隐式lang_code=g.current_lang传递url_for?并且只写 {{ url_for('about') }}
我的路由器看起来像:
@app.route('/<lang_code>/about/')
def about():
...
Run Code Online (Sandbox Code Playgroud) 我想在页面上放几个不同背景颜色的jumbotron(bootstrap 3).请帮帮我.