我正在通过python金字塔教程,我在我写的文件中尽可能多地做了笔记。
发生了一些奇怪的事情,我想知道原因。我编写了development.ini文件,就像在教程中完成的那样,然后添加了注释。
# we are using this file for configureation in development
# config our wsgi
[app:main]
# which entry point to use as the app
use = egg:mysite
# reloads when templates are changed, not to be used in production
pyramid.reload_templates = true
#which server to use
[server:main]
#get the main entry point from the waitress package
use = egg:waitress#main
host = 0.0.0.0
port = 6534
# this is a great way to remove code for the rest of our package
# more importantly this file is easy to tweak for launching our package in a different manner
运行 pserve development.ini chrome返回:
This site can’t be reached
0.0.0.0 refused to connect.
Search Google for 6543
ERR_CONNECTION_REFUSED
我删除了评论:
[app:main]
use = egg:mysite
pyramid.reload_templates = true
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6534
我收到与以前相同的错误。
This site can’t be reached
0.0.0.0 refused to connect.
Search Google for 6543
ERR_CONNECTION_REFUSED
然后我将教程repo中的代码复制并粘贴到development.ini:
[app:main]
use = egg:mysite
pyramid.reload_templates = true
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
我已成功访问localhost。
我最感兴趣的是,为什么会发生这种情况,如何避免这个问题,如果可能的话,如何评论development.ini文件。
注意:
答案 0 :(得分:1)
$Data = $con->prepare("SELECT Example1,Example2,Example3,Example4 FROM SITES WHERE Email=:Email");
$Data->execute(array(
':Email' => $Email,
));
if ($Data->rowCount() > 0) {
$Rows = $Data->rowCount();
$CL = 1;
$Result = $Data->fetch(PDO::FETCH_ASSOC);
while ($CL <= $Rows) {
$Example1 = $Result['Example1'];
$Example2 = $Result['Example2'];
$Example3 = $Result['Example3'];
$Example4 = $Result['Example4'];
//$CL = $CL++; This is bad;
$CL++;
echo
'<tr class="tr">'; <?
<td class="td"><?php echo $Example1 ;?></td>
<td class="td"><?php echo $Example2 ;?></td>
<td class="td"><?php echo $Example3 ;?></td>
<td class="td"><?php echo $Example4 ;?></td>
<td class="td"></td>
<?php
echo '</tr>';
}
}
表示您在Chrome地址栏中输入的端口与ERR_CONNECTION_REFUSED
文件中的端口号配置不一致。仔细查看您的端口号以确保它们对齐。您已将.ini
和4
转置为原始3
(.ini
),因此我假设您尝试在Chrome的地址栏中找到http://0.0.0.0:6543
额外提示:PyCharm允许您比较磁盘上的单个文件历史记录以及版本控制。这有助于揭示印刷错误。右键/ CTRL-单击文件,本地历史记录&gt;显示历史。