有谁知道如何更改Apache服务器的文档根目录?我基本上想localhost从/users/spencer/projects目录来代替/var/www.
我最终搞清楚了.有人建议我更改httpd.conf文件,但我最终找到了一个文件,/etc/apache2/sites-available/default并将根目录更改为/var/www,/home/myusername/projects_folder并且工作正常.
如果我有一个我开始使用的docker容器,那么在该运行容器中设置环境变量的最佳方法是什么?我在运行run命令时最初设置了一个环境变量.
$ docker run --name my-wordpress -e VIRTUAL_HOST=domain.com --link my-mysql:mysql -d spencercooley/wordpress
Run Code Online (Sandbox Code Playgroud)
但是现在它已经运行了一段时间我想VIRTUAL_HOST在环境变量中添加另一个.我不想删除容器,然后只使用我想要的环境变量重新运行它,因为那时我必须将旧卷迁移到新容器,它有主题文件和上传,我不想要输.
我只想改变VIRTUAL_HOST环境变量的值.
我只想在图像上做一个简单的链接.
<a href="http://www.mysite.com"><img src="path/to/image.png"/></a>
Run Code Online (Sandbox Code Playgroud)
你如何使用link_to rails标签做到这一点?
一切都被包裹在一个div中 id="main_wrap"
主要包装有这种风格:
#main_wrap{
margin:0 auto;
width:960px;
position:relative;
}
Run Code Online (Sandbox Code Playgroud)
由于所有内容都包含在div中,我不明白为什么水平滚动条会出现在底部.
我正在尝试使用leaflet.js构建一个地图应用程序,我无法弄清楚如何使用.off方法.文档没有任何示例,我似乎无法在网上找到任何其他内容.我已经将问题提炼成一个更简单的代码块,所以我的问题可以更清楚.
基本上我已将其设置为当您单击"启用单击"链接时,它将添加一个事件侦听器,每次单击它时都会向地图添加标记.我想在您点击"禁用点击"时删除该事件监听器.
这是我现在的代码.
$(document).ready(function(){
var map, cloudmade, sanAntonio, polygonPoints
map = new L.Map('map');
cloudmade = new L.TileLayer('http://{s}.tile.cloudmade.com/d4334cd6077140e3b92ccfae2b363070/997/256/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 18
});
sanAntonio = new L.LatLng(29.4238889, -98.4933333); // geographical point (longitude and latitude)
map.setView(sanAntonio, 13).addLayer(cloudmade);
//everything above sets up the map
function enableClick(){
map.on('click', function(e) {
var marker = new L.Marker(e.latlng, {draggable:true});
map.addLayer(marker);
});//closes the click function
this.disableClick = function(){
map.off('click');
}
}
//when
$('#enable_click').click(function(){
var enable_click …Run Code Online (Sandbox Code Playgroud) 我正在学习如何创建api端点,我正在尝试编写一个测试,以查看post请求是否返回200状态代码.我计划编写更多测试,以查看端点是否也返回了所有预期的结果.我一直收到403状态代码,我认为这是因为我需要在post数据中包含一个csrf标记.在django中测试POST端点的好方法是什么?
我的测试:
from django.test import TestCase
from app import settings
import requests
class ProjectEndpoint(TestCase):
def post_endpoint(self):
data = {'hello':'23'}
post_project = requests.post(settings.BASE_URL+'/api/project', params=data)
self.assertEqual(post_endpoint.status_code, 200)
Run Code Online (Sandbox Code Playgroud)
这个测试在403!= 200时仍然失败
我认为这是因为视图可以防止csrf攻击,但我真的不确定.欣赏某人的任何洞察力.
这是JavaScript:
$(document).ready(function(){
//set location of san antonio
var san_antonio = new google.maps.LatLng(29.4, -98.544);
//set infowindow
var infoWindow;
//object literal containing the properties
var options = {
zoom: 9,
center: san_antonio,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
//create the map
var map = new google.maps.Map(document.getElementById('map'), options);
//create marker
var marker = new google.maps.Marker({
position: san_antonio,
map:map,
title: "san antonio"
});
//add 'click' event listener
google.maps.event.addListener(marker, 'click', function(){
//creates infowindow if it already doesn't exist
if (!infoWindow){
infoWindow = new google.maps.InfoWindow();
}
//create content for …Run Code Online (Sandbox Code Playgroud) Appname::Application.configure do
config.action_mailer.delivery_method = :smtp
#typical smtp_settings for gmail account
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "domain.of.sender.net",
:authentication => "plain"
:user_name => "spencecooley"
:password => "secret"
:enable_starttls_auto => true
}
end
Run Code Online (Sandbox Code Playgroud)
我有两个关于配置动作邮件的问题
:enable_starttls_auto => true做什么更新:
好的,所以我在参考问题2的文档中找到了这个
:enable_starttls_auto - 设置为true时,检测SMTP服务器中是否启用了STARTTLS并开始使用它
不知道STARTTLS是什么,所以我在这里查了一下http://en.wikipedia.org/wiki/STARTTLS
更新:我在文档中发现了这个,但仍然不明白
:domain - 如果您需要指定HELO域,可以在此处执行.
所以我猜新问题是:什么是HELO域名?似乎无法找到明确的答案.
我正在为Web应用程序制作区域绘图工具,我使用标记作为锚点,用户可以使用它来更改多边形的形状.
这就是我到目前为止所拥有的.http://demos.nodeline.com/leaflet_development/
回购邮件是https://github.com/SpencerCooley/Leaflet_development
$(document).ready(function(){
var map, cloudmade, sanAntonio, polygonPoints
map = new L.Map('map');
cloudmade = new L.TileLayer('http://{s}.tile.cloudmade.com/d4334cd6077140e3b92ccfae2b363070/997/256/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 18
});
sanAntonio = new L.LatLng(29.4238889, -98.4933333); // geographical point (longitude and latitude)
map.setView(sanAntonio, 13).addLayer(cloudmade);
polygonPoints = [];
var polygon = new L.Polygon(polygonPoints);
map.addLayer(polygon);
map.on('click', function(e) {
var marker = new L.Marker(e.latlng, {draggable:true});
polygonPoints.push(e.latlng);
var markerId = polygonPoints.length -1
map.addLayer(marker);
polygon.setLatLngs(polygonPoints);
marker.on('drag', function(){
var locationWhileDrag = …Run Code Online (Sandbox Code Playgroud)