小编joe*_*cox的帖子

嵌套木偶区域,布局和视图

我正在尝试将我的Marionette视图与应用程序区域和布局结合使用,但我似乎无法在布局中获取嵌套视图以进行渲染.

编辑:我预计双方OptionsViewBreadcrumbsView在被渲染NavigationLayout,这应该在导航区域进行渲染.但是,根本不渲染导航区域.控制台不显示任何错误.

我的结构如下:

- Navigation region
  - Navigation layout
    - Options region 
    - Breadcrumbs region
- Content region
Run Code Online (Sandbox Code Playgroud)

分配ItemView给导航区域按预期工作.

App = new Backbone.Marionette.Application();
App.addRegions({
    'nav': '#nav',
    'content': '#content'
});

var NavigationLayout = Backbone.Marionette.Layout.extend({
    template: '#nav-template',
    regions: {
        'breadcrumbs': '#breadcrumbs',
        'options': '#options'
    }
});

var BreadcrumbsView = Backbone.Marionette.ItemView.extend({
    template: '#breadcrumbs-template'
});

var OptionsView = Backbone.Marionette.ItemView.extend({
    template: '#options-template'
});

var ContentView = Backbone.Marionette.ItemView.extend({
    template: '#content-template'
});

App.addInitializer(function(options) {
    var navigationLayout = new NavigationLayout(); …
Run Code Online (Sandbox Code Playgroud)

backbone.js marionette

9
推荐指数
1
解决办法
5579
查看次数

CodeIgniter项目的Git环境

我开始使用基于CI 2.0 Reactor存储库的新CI项目.因为CI2代码仍在变化,我想保持代码新鲜,问题是如何(使用Git).

对于非CI人员,CI2项目的基本结构如下所示:

system/  
application/  
index.php
...
Run Code Online (Sandbox Code Playgroud)

系统目录包含框架,index.php执行引导和应用程序包含我的项目.理想情况下,我想使用Git使index.php和系统文件夹保持最新.我想要遵守的另一件事是应用程序文件夹的名称.(您可以在index.php中更改应用程序文件夹的路径.)保持名称相同可以直接放入文件夹,然后离开.

我试图通过使用git子模块来实现这一点(见下文),但是子模块不允许您从目标存储库中指定目录.

git submodule add https://github.com/philsturgeon/codeigniter-reactor.git/code-igniter/system system
Run Code Online (Sandbox Code Playgroud)

任何线索我怎么能实现这一目标?

git codeigniter codeigniter-2

6
推荐指数
2
解决办法
4124
查看次数

使用主题交换运行多个 Celery 任务

我正在用 Celery 替换一些自制代码,但很难复制当前的行为。我期望的行为如下:

  • tasks创建新用户时,应使用路由密钥将消息发布到交换器user.created
  • 此消息应触发两个 Celery 任务,即send_user_activate_emailcheck_spam

我尝试通过定义user_created带有参数的任务以及和 的ignore_result=True任务来实现此目的。send_user_activate_emailcheck_spam

在我的配置中,我添加了以下路由和队列定义。当消息传递到user_created队列时,它不会传递到其他两个队列。

理想情况下,消息仅传递到send_user_activate_emailcheck_spam队列。当使用 vanilla RabbitMQ 时,消息被发布到交换器,队列可以绑定到交换器,但 Celery 似乎直接将消息传递到队列。

我将如何在 Celery 中实现上述行为?

CELERY_QUEUES = {
    'user_created': {'binding_key':'user.created', 'exchange': 'tasks', 'exchange_type': 'topic'},
    'send_user_activate_email': {'binding_key':'user.created', 'exchange': 'tasks', 'exchange_type': 'topic'},
    'check_spam': {'binding_key':'user.created', 'exchange': 'tasks', 'exchange_type': 'topic'},
}

CELERY_ROUTES = {
    'user_created': {
        'queue': 'user_created',
        'routing_key': 'user.created',
        'exchange': 'tasks',
        'exchange_type': 'topic',
    },
    'send_user_activate_email': {
        'queue': 'user_created',
        'routing_key': 'user.created', …
Run Code Online (Sandbox Code Playgroud)

python messaging message-queue rabbitmq celery

5
推荐指数
1
解决办法
3529
查看次数