我在IIS8上安装了django.现在我想配置它来提供静态文件.我一直在关注这个教程
我已将此添加到settings.py中
STATIC_URL ='/ static /'
STATIC_ROOT ='C:/ my_django_project/NZtracker/static_for_production /'
STATICFILES_DIRS =('C:/ my_django_project/NZtracker/static /',)
然后运行collectstatic.
因此,所有静态文件夹都已移至C:/ my_django_project/NZtracker/static_for_production /.
接下来,我试图配置IIS来提供该文件夹中的文件但不能.(我试过这篇文章,但它也没有用)
我该如何解决?谢谢
我使用的是Windows 7和Python 3.4.3.我想在浏览器中运行这个简单的helloworld.py文件:
print('Content-Type: text/html')
print( '<html>')
print( '<head></head>')
print( '<body>')
print( '<h2>Hello World</h2>')
print( '</body></html>')
Run Code Online (Sandbox Code Playgroud)
我所做的是:
1)转到命令行C:\Python(安装python的地方)
2)运行: python -m http.server
3)到Firefox并输入 http://localhost:8000/hello.py
但是,浏览器只打印hello.py文件的内容,而不是"Hello World".
我该如何解决?
我正在尝试配置我的.htaccess文件来设置缓存时间.尝试了所有可能的配置但没有任何作用!
这是我的HTML中写的:
<meta http-equiv="Cache-Control" content="max-age=2592000, public" />
<!--
<meta http-equiv="expires" content="mon, 24 sep 2012 14:30:00 GMT">
-->
Run Code Online (Sandbox Code Playgroud)
这就是我的.htaccess文件中写的内容:
ExpiresActive On
ExpiresDefault A3600
Run Code Online (Sandbox Code Playgroud)
但是,当我在firefox中刷新包含缓存清除(ctrl + F5)时,我的firebug NET面板说缓存在我访问该文件的同一秒内到期(而不是将来,就像我希望的那样).
我究竟做错了什么??
谢谢
我使用谷歌地图api来计算从A点到B点的溃败."DirectionsResult"对象给了我很多关于距离等的信息 .https://developers.google.com/maps/documentation/javascript/方向#DirectionsResults
但是,我很想知道HIGHWAY道路的距离(部分路线)是什么,以及CITY道路的哪个部分.
我怎样才能做到这一点?
谢谢!
我想使用谷歌api在我的网站绘制图表.但是,我的google.setOnLoadCallback功能有问题.这是我的代码(简化):
ATTEMPT 1 :(工作正常)
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/styling.js"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(helloWorld);
function helloWorld() {
alert("Hello World");
}
</script>
Run Code Online (Sandbox Code Playgroud)
ATTEMPT 2 :(工作正常)
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/styling.js"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization …Run Code Online (Sandbox Code Playgroud) 我想用python发送一个简单的邮件
import smtplib
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login("mymail@gmail.com", "mypassword")
msg = "Hello world"
server.sendmail("mymail@gmail.com", "mymail@gmail.com", msg)
server.quit()
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
server.login("user@gmail.com", "psw")
File "C:\Python\lib\smtplib.py", line 652, in login
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (534, b'5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbuxb\n5.7.14 4i2u8qU8V3jgf6uGv8da1RAGPJyctRvIFy_kjai6aKVx_B6qVhoz_dzFpvfPC18H-jeM6K\n5.7.14 cnm2HVuq-wr-uw59hD31ms-cxMmnZuq6Z3_liDaDmu8_UqaiUwR4FUiuX2i5pPdQjJzFvv\n5.7.14 4VrEF5XT4ol2iN17gnB_jITpwzsjH9Ox3NCNcfl7SriHr5m7esc15PWI0CG_2CTlyh7RxW\n5.7.14 XhoJPajs8GMd-khOQWUqucywfrfo> Please log in via your web browser and\n5.7.14 then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 ef10sm13614207wjd.49 - gsmtp')
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
谢谢
我正在使用'simpLESS'程序将我的.less文件动态编译成.css文件.
真的很棒!
然而,在使用它几天后,'simpLESS'停止将.less文件复制到.css文件中.我试图重新安装,重新下载然后重新安装,尝试其他目录,其他.less文件,尝试重新编译manuall - 但没有任何作用.
有没有人经历过这个?
谢谢!
我想画一个图标,旁边有文字,下面的例子:
不好的例子:
@ text text text text text text
text text text text text text
text text text text text text
Run Code Online (Sandbox Code Playgroud)
好例子:
@ text text text text text text
text text text text text text
text text text text text text
Run Code Online (Sandbox Code Playgroud)
请问第二个例子怎么办?谢谢.
我有这么简单的代码:
HTML:
<body>
<div id="red"> ABC </div>
<div id="blue"> ABC </div>
</body>
Run Code Online (Sandbox Code Playgroud)
CSS:
body{
width: 300px;
}
#red{
float:left;
width: 100px;
height: 100px;
background-color: red;
}
#blue{
height: 100px;
background-color: blue;
}
Run Code Online (Sandbox Code Playgroud)
我看到旁边的红色方形和蓝色.
但是,如果我添加行"width:100px;" 在#blue中,一切都毁了:"ABC"跳"一条线向下,没有蓝色背景.为什么?
我使用'urllib.request.urlopen'来阅读HTML页面的内容.之后,我想将内容打印到我的本地文件,然后执行某个操作(例如,在该页面上构建解析器,例如BeautifulSoup).
问题 在第一次读取内容(并将其写入文件)后,我无法第二次读取内容以便对其执行某些操作(例如,在其上构建解析器).它只是空的,我无法将光标(搜索(0))移回到开头.
import urllib.request
response = urllib.request.urlopen("http://finance.yahoo.com")
file = open( "myTestFile.html", "w")
file.write( response.read() ) # Tried responce.readlines(), but that did not help me
#Tried: response.seek() but that did not work
print( response.read() ) # Actually, I want something done here... e.g. construct a parser:
# BeautifulSoup(response).
# Anyway this is an empty result
file.close()
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
非常感谢你!