我想在我的django应用程序上做一些功能测试.我正在使用selenium,测试工作但问题是静态文件.找不到css/js状态.我的测试是在localhost:8081上运行的.示例bootstrap.css:
<h1>Not Found</h1><p>The requested URL /static/frontend/bootstrap/3.3.0/css/bootstrap.css was not found on this server.</p>
Run Code Online (Sandbox Code Playgroud)
我找不到任何信息我是否为selenium app添加了一些额外的配置?
追溯:
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/t/py/django/bid/src/venv/local/lib/python2.7/site-packages/django/test/testcases.py", line 1028, in __call__
return super(FSFilesHandler, self).__call__(environ, start_response)
File "/home/t/py/django/bid/src/venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
response = self.get_response(request)
File "/home/t/py/django/bid/src/venv/local/lib/python2.7/site-packages/django/test/testcases.py", line 1011, in get_response
return self.serve(request)
File "/home/t/py/django/bid/src/venv/local/lib/python2.7/site-packages/django/test/testcases.py", line 1023, in serve
return serve(request, final_rel_path, document_root=self.get_base_dir())
File "/home/t/py/django/bid/src/venv/local/lib/python2.7/site-packages/django/views/static.py", line 50, in serve
fullpath = os.path.join(document_root, newpath)
File "/home/t/py/django/bid/src/venv/lib/python2.7/posixpath.py", line …
Run Code Online (Sandbox Code Playgroud) 我的数据库中有一个文本.我从xhr发送一些文字给我看.函数find找不到一些unicode字符.我想使用以下方法查找所选文本:
text.find(selection)
Run Code Online (Sandbox Code Playgroud)
但有时变量'选择'有这样的字符:
? # in xhr unichr(281)
Run Code Online (Sandbox Code Playgroud)
在变量'text'中有一个char:
e? # in db has two chars unichr(101) + unichr(808)
Run Code Online (Sandbox Code Playgroud) 我通过 vagrant 在远程服务器上安装了 mongodb。我可以从本地系统访问 postgres,但 mongo 不可用。当我通过 ssh 登录并检查 mongo 状态时,它说 mongo 正在运行,我也可以进行查询。当我尝试使用以下命令从本地系统连接时:
mongo 192.168.192.168:27017
Run Code Online (Sandbox Code Playgroud)
我收到一个错误
MongoDB shell version: 2.6.5
connecting to: 192.168.192.168:27017/test
2014-12-27T22:19:19.417+0100 warning: Failed to connect to 192.168.192.168:27017, reason: errno:111 Connection refused
2014-12-27T22:19:19.418+0100 Error: couldn't connect to server 192.168.192.168:27017 (192.168.192.168), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
Run Code Online (Sandbox Code Playgroud)
看起来 mongo 不收听来自其他 ip 的连接?我在 mongo 设置中评论了 bind_ip 但它没有帮助。
通过 nmap 命令为 192.168.192.168 提供服务:
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
5432/tcp open postgresql
9000/tcp …
Run Code Online (Sandbox Code Playgroud) 你好,我把数据作为JSON格式,在我的服务器网站上,我必须通过Doctrine存储它们.一切都很顺利,但当我收到日期时间格式数据时,我有验证错误.我在控制器中的分离动作上测试这种情况:
public function indexAction($name)
{
$em = $this->getDoctrine()->getManager();
$test = new Test();
$test->setName("Test");
//$test->setStart(new \DateTime());
$form = $this->createForm(new TestType(), $test);
$store = array(
"name" => "Test",
"start" => new \DateTime()//will be something like *2014-04-09 11:11:11'
);
$form->submit($store);
if ($form->isValid()) {
$em->persist($test);
$em->flush();
} else var_dump($this->getErrorMessages($form));
return $this->render('CodeTestBundle:Default:index.html.twig', array('name' => $name));
}
Run Code Online (Sandbox Code Playgroud)
var dump是:
array(size = 1)'start'=> array(size = 3)0 => string'此值无效.' (长度= 24)
Run Code Online (Sandbox Code Playgroud)'date' => array (size=3) 'year' => array (size=0) ... 'month' => array (size=0) ... 'day' => array …