测试网站的Python文件

时间:2017-07-11 17:49:02

标签: python-2.7

我目前有一个使用AWS EC2实例,Wampserver,PHP,Apache,MySQL和Python的实时服务器(以及用于网站基本设计和结构的HTML / CSS)。该网站本身功能齐全,我在本地计算机上有一个测试环境,可以在网站上线之前测试更改。我已经能够测试HTML文件的更改,只需双击文件,我的浏览器就会出现相应的网页。但是当涉及到我的Python文件时,双击它们会导致我的命令提示符短暂地打开python代码,然后消失。我在youtube上的pyinstaller和py2exe上看到的教程并没有提供帮助。我需要使用哪些命令来查看本地版本的python文件的网站输出。 我的一个python文件的示例:

#!c:/Python27/python.exe

# Import modules for CGI handling
import cgi, cgitb
# Create instance of FieldStorage
form = cgi.FieldStorage()
print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<style>"
print "body {background-color: white;}"
print "h1   {color:#007acc; font-family: 'Baskerville Old Face'; font-size: 350%; text-align: center}"
print "p1   {color:#007acc; font-family: 'Baskerville Old Face'; font-size: 200%; text-align: center}"
print "p2   {color:#007acc; font-family: 'Baskerville Old Face'; font-size: 200%; text-align: center}"
print "table {border-collapse: collapse;}table, th, td {border: 1px solid black; padding: 15px; font-size: 14; align: center; text-align: center; padding: 2px;}"
print "body2 {color:Black; margin: center; font-size: 120%; text-align: center}"
print "</style>"
print "<a href='index.html'>"
print "<img src='https://victorfont.com/wp-content/uploads/2015/06/home-150499_1280.png' alt='HOME' align='left' height='38' width='38'></a>"
print "</head>"
print "<body>"
print "<h1> Fruit Store </h1>"
print """<form action="1.1.1.A.FoodDetails.py" method="post">"""
print """<div class = "InputInfo"> Please enter Food: <input type="text" name="Food" id = "Food"  maxlength="9" size="10">"""
print """&nbsp&nbsp&nbsp&nbsp Type:<a href="#" title="Select the Type of product."><img src="https://shots.jotform.com/kade/Screenshots/blue_question_mark.png" height="13px"/></a>
<select name="Product" id = "Product"required>
<option value="">Select</option>
<option value="Apple">Apple</option>
<option value="Banana">Banana</option>
<option value="Carrot">Carrot</option>
</select>"""
print """&nbsp&nbsp&nbsp&nbsp<input type="Submit" class= "submitbutton" value="Submit" /> </div> <br> <br>"""
print "</body>"

如果我能进一步解释,请告诉我。感谢

0 个答案:

没有答案
相关问题