首页 \ 问答 \ 如何从Django异步处理数据库写入(可能带有消息队列)?(How to process database writes asynchronously (maybe with a message queue) from Django?)

如何从Django异步处理数据库写入(可能带有消息队列)?(How to process database writes asynchronously (maybe with a message queue) from Django?)

用户向我的应用程序提交数据后,我想通过消息队列异步地写入数据库。

我如何设置这样一个系统? 是否有可执行此类基于消息队列的数据库写入的可插入Django应用程序?

另外我如何处理异步处理期间发生的错误?

真的很感谢你能给我的任何指针。 谢谢。


After a user submitted data to my app, I'd like to write to the database asynchronously, possibly through a message queue.

How do I set up such a system? Are there any pluggable Django apps that do such message queue-based database writes?

Also how do i handle errors that happens during the async processing?

Would really appreciate any pointers you can give me. Thank you.


原文:https://stackoverflow.com/questions/2793056
更新时间:2023-09-02 12:09

最满意答案

发现了问题。 我写了一些错误的代码,试图在彼此内部实例化更多的模板视图。

我知道模板视图的限制纯粹与scrollview(当然还有stencilView类本身)有关,因为它是唯一一个继承这个类的人。

所以你不能在彼此内部实例化8个以上的scrollview,这看起来非常好。

class stencilTest(App):
     def build(self):
        super(stencilTest, self).__init__()
        root = GridLayout(cols=1, spacing=10, size_hint_y=None)
        r = root
        for i in range(10):
            w = ScrollView(size_hint=(1, 1), size=(1000, 800))
            r.add_widget(w)
            r = r.children[0]       
        return root


if __name__ == "__main__":
     stencilTest().run()

如果感兴趣,此代码将重现错误


Found the problem. I wrote some bad code that was trying to instantiate more stencil view inside each other.

I understood that the limit of the stencil view is related purely to scrollview (and the stencilView class itself of course) because it's the only one to inherit this class.

So you can't instantiate more than 8 scrollview inside each other, which seems perfectly fine.

class stencilTest(App):
     def build(self):
        super(stencilTest, self).__init__()
        root = GridLayout(cols=1, spacing=10, size_hint_y=None)
        r = root
        for i in range(10):
            w = ScrollView(size_hint=(1, 1), size=(1000, 800))
            r.add_widget(w)
            r = r.children[0]       
        return root


if __name__ == "__main__":
     stencilTest().run()

This code will reproduce the error if interested

相关问答

更多
  • 没有这样的功能只能清除深度/模板视图的一部分。 这是我解决问题的方法: 做一个纹理。 将部件的Alpha设置为清除为1,将其他部分设置为0。 打开AlphaTest ,只打开alpha为1的像素。 打开AlphaBlend ,将BlendOP设置为Add ,将SrcBlend factor设置为0,将DestBlend factor设置为1。 将StencilTest和DepthTest设置为Always ,将StencilRef设置为要清除的值。 使用正交投影矩阵。 绘制一个仅覆盖屏幕的矩形(z坐标/(Z ...
  • 没有一个前置表达式可以调用所有产品或来自特定类别的产品。 设置大量新的或特色产品并使用它们来填充您的主页会更容易。 需要注意的是,您选择显示的产品数量可能会对加载时间和用户体验产生负面影响,因此如果您选择此路线,我会以增量方式延迟加载产品。 There isn't a front matter expression that will call all products or call products from a specific category. It would be easier to set ...
  • 我修好了,感谢猫头鹰向正确的方向点头。 事实上,我实际上是在释放光栅器状态,以便使用深度模板。 对于有同样问题的人,我会在这里留下这个答案。 I fixed it, thanks to catflier's nod in the right direction. Turns out I was actually releasing the rasterizer state too early for the depth stencil to be used. I'll leave this answer h ...
  • 如果你看到这个,你可以通过在你正在使用的目录中安装jspm来解决它。如果你需要jspm用于其他项目,这没有用,但是它会让你暂时使用Stencil。 本页第2点 If you are seeing this, you can resolve it by installing jspm just in the directory you are working in. This doesn't help if you need jspm for other projects, but it will get y ...
  • 发现了问题。 我写了一些错误的代码,试图在彼此内部实例化更多的模板视图。 我知道模板视图的限制纯粹与scrollview(当然还有stencilView类本身)有关,因为它是唯一一个继承这个类的人。 所以你不能在彼此内部实例化8个以上的scrollview,这看起来非常好。 class stencilTest(App): def build(self): super(stencilTest, self).__init__() root = GridLayout(co ...
  • 我使用条件而不是dynamicComponent。 这不是我认为的。 I used if conditionals instead of dynamicComponent. It wasn't what I thought it was.
  • 我使用RenderTarget2D而不是模板缓冲区解决了这个问题。 将纯黑色阴影绘制到RT2D,然后将RT2D本身绘制成具有半透明颜色的场景,可以实现并简化实现。 I worked around the issue by using a RenderTarget2D instead of the stencil buffer. Drawing solid black shadows to a RT2D and then drawing the RT2D itself into the scene with ...
  • 虽然它似乎并不理想,但我能够通过disabled模板来完成我想要的任务: var stencil = dojoDrawing.addStencil("rect", { x : someXVal, y : someYVal, width : someWidth, height : someHeight }); stencil.disable(); 这会将模板颜色更改为disabled状态,使其无法选择,因此无法移动。 Although it doesn't seem ide ...
  • 关于你的观点设计。 您的视图的全局设计是可以的,这意味着有一个单独的视图来测试文档的“类型/值”并根据此值发出不同的索引。 你说你有11个观点,它们是如何组织的? 有多少设计文件? 观点/设计文件? 我问这个是因为设计文档中的所有视图都在同一时间更新。 看一看“View Design Best Practice”一章: http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writing-bestpractice.html 你的 ...
  • 也许glClipPlane是你想要的? 或者你可以看看Oblique Near Plane Clipping ,试着做一些时髦的投影数学,修改你的近平面是门户的。 Maybe glClipPlane is what you want? Or you could take a look at Oblique Near Plane Clipping, to try to do some funky projection math that modifies your near plane to be that ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)