我想在Kohana 3.3.0中使用带有ORM驱动程序的Auth模块,但我唯一能做的就是在数据库中插入新用户.我不能用他们登录.
我从一个空白的Kohana项目,一个简单的路径,数据库配置文件开始,然后我导入了ORM模块中包含的auth SQL模式(没有其他表).我没有为用户创建新的模型文件.
这是我复制到app path/config目录的配置文件:
<?php defined('SYSPATH') or die('No direct access allowed.');
return array(
'driver' => 'ORM',
'hash_method' => 'sha256',
'hash_key' => 'secretkey',
'lifetime' => 1209600,
'session_type' => Session::$default,
'session_key' => 'auth_user',
'users' => array()
);
Run Code Online (Sandbox Code Playgroud)
现在这是我的简单控制器.我尝试将用户加载到te数据库,然后使用该用户登录.
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_User extends Controller {
public function action_index(){
// Enter a new user manually
$user = ORM::factory('user');
$user->username = 'mylogin';
$user->password = 'mypassword';
$user->email = 'me@email.fr';
try{
$user->save();
}
catch(ORM_Validation_Exception $e){
$errors = $e->errors();
} …
Run Code Online (Sandbox Code Playgroud) 我正在使用带有gunicorn服务器和gevent worker类的Flask应用程序,根据gunicorn文档,该类是一个异步worker。但是,当我与一个工作人员一起启动gunicorn并尝试提出一个较长的请求时(我sleep(10)
在route函数中添加了,但实际上在处理大量上载时也会发生这种情况),直到上一个请求完成之前,我无法提出任何请求。它的行为就像是同步工作器一样,一次只有一个请求。
这是正常现象吗?我是否缺少有关同步与异步工作程序的信息?