首页 \ 问答 \ 如何在Django中加载页面后才显示内容(How to show content only after loading the page in Django)

如何在Django中加载页面后才显示内容(How to show content only after loading the page in Django)

我的代码在模板中加载很慢并且正在变形html。 我想知道如何隐藏这些内容,直到页面完全加载。

我的代码:

{% for movimentacao in movimentacoes %}
                <tr>
                            <td><a href="#">{{ movimentacao.processo }}</a></td>
                            <td>{{ movimentacao.descricao }}</td>
                            <td>{{ movimentacao.responsavel }}</td>
                            <td>{{ movimentacao.dt_mov }}</td>
                            <td>{{ movimentacao.cliente1 }}</td>
                </tr>
{% endfor %}


My code is slow to load in the template and is deforming the html. I wonder how to hide this content until the page has loaded completely.

My code:

{% for movimentacao in movimentacoes %}
                <tr>
                            <td><a href="#">{{ movimentacao.processo }}</a></td>
                            <td>{{ movimentacao.descricao }}</td>
                            <td>{{ movimentacao.responsavel }}</td>
                            <td>{{ movimentacao.dt_mov }}</td>
                            <td>{{ movimentacao.cliente1 }}</td>
                </tr>
{% endfor %}


原文:https://stackoverflow.com/questions/29759239
更新时间:2022-07-12 19:07

最满意答案

这个问题上周解决了。 问题是我正在进行文件写操作以存储Hbase记录的密钥。 我这样做是为了存储Key incase of exception。 文件写入操作没有单个Hbase记录读取那么快,并且时间增加了近100倍。

        FileWriter fileWriter = new FileWriter(file, true);
        BufferedWriter bufferWriter = new BufferedWriter(fileWriter);
        bufferWriter.write(rowKey);
        bufferWriter.write("\n");
        bufferWriter.close();

一旦我评论了这个逻辑并将它移到了Catch块中,这个工作就非常快了。 大约2亿条记录均在12小时内处理完毕。


This issue was resolved last week. The issue was that I was having file write operation for storing the Key of the Hbase record. I was doing it for storing the Key incase of exception. The file write operation is not as fast as single Hbase record read and increased the time almost 100 fold.

        FileWriter fileWriter = new FileWriter(file, true);
        BufferedWriter bufferWriter = new BufferedWriter(fileWriter);
        bufferWriter.write(rowKey);
        bufferWriter.write("\n");
        bufferWriter.close();

Once I commented this logic and moved it in the Catch block this job was very fast. About 200M records were all processed in below 12 hrs.

相关问答

更多
  • 我试图在Linux上找到关于mmap / read性能的最后一个字,我在Linux内核邮件列表中发现了一个很好的帖子( 链接 )。 从2000年开始,从那时起,内核中的IO和虚拟内存已经有了很多改进,但是它很好地解释了mmap或者read可能更快或更慢的原因。 调用mmap比read更多的开销(就像epoll比poll更多的开销,这比开销大于read )。 出于同样的原因,在一些处理器上更改虚拟内存映射是相当昂贵的操作,因为不同进程之间的切换是昂贵的。 IO系统可以使用磁盘缓存,因此,如果您读取文件,则无论 ...
  • char buffer[4096]; int n; while (fgets(buffer, sizeof(buffer), fp) != 0) { if ((n = sscanf(buffer, "%[^\t] %[^\t] %[^\t\n]", rec[size].name, rec[size].address, rec[size].phone_number)) != 3) { if (n != EOF) fprintf(stde ...
  • 在我看来,只有处理大量数据时才需要存储过程。 性能更好,因为数据库管理系统可以使用其优化例程来加速对存储数据的访问。 不使用存储过程的第二个原因是,你想分开dbms和你的应用程序。 所以如果你愿意,你可以改变数据库系统。 如果你使用存储过程绑定到这个指定的dbms(即oracle)。 In my opinion, stored procedures are only necessary if you handle a vast amount of data. The performance is bette ...
  • 使用这篇文章中的确切数据库结构来解决您的问题,您需要查询数据库两次。 一次获得您需要的特定用户的职位ID,然后获取自己的职位。 要实现这一点,请使用以下代码: String uid = FirebaseAuth.getInstance().getCurrentUser().getUid(); DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference(); DatabaseReference postsRef = root ...
  • Splice Machine(开源)有一个演示火花流运行的演示。 http://community.splicemachine.com/category/tutorials/data-ingestion-streaming/ 以下是此用例的示例代码。 https://github.com/splicemachine/splice-community-sample-code/tree/master/tutorial-kafka-spark-streaming Splice Machine (Open Sour ...
  • 这个问题上周解决了。 问题是我正在进行文件写操作以存储Hbase记录的密钥。 我这样做是为了存储Key incase of exception。 文件写入操作没有单个Hbase记录读取那么快,并且时间增加了近100倍。 FileWriter fileWriter = new FileWriter(file, true); BufferedWriter bufferWriter = new BufferedWriter(fileWriter); bufferWr ...
  • 没有理由在完成处理程序中查询已保存的记录。 saveRecord:completionHandler:的完成处理程序saveRecord:completionHandler:如果成功则为您提供已保存的记录,如果saveRecord:completionHandler:错误。 顺便说一句 - 查询失败的原因是因为你这么做太快了。 保存的记录需要一点时间才能上传和编入索引。 这就是为什么您需要使用完成处理程序的参数而不是这么快就执行查询的原因。 There is no reason to query for t ...
  • 好吧显然这是一个意想不到的依赖问题(因为它始终没有任何意义)。 这些是我为解决这个问题而采取的步骤(希望它们能帮助未来的开发人员): 我使用完全相同的代码创建了一个干净的项目。 这没有任何问题立即让我怀疑它是某种依赖性问题 为了确保,我将HBase依赖项放在依赖项的顶部。 这创建了一个与Spark和安全性相关的异常,更具体地说:javax.servlet.FilterRegistration 然后我遇到了这个有用的解决方案,为我解决了这个问题。 我不得不从我的pom中排除所有的javax和mortbay码头 ...
  • 我通过多次处理文件解决了这个问题。 在每次传递时,我都会尝试使用这样的alg来读取\处理文件中的每个记录: 如果记录有父级 - 检查父级是否已存储。 如果不是 - 我在处理器中跳过它 如果记录未更改(或者如果无法更新则已存储) - 在处理器中跳过它 else - 存储在db中 然后声明循环和决策:
  • 你唯一错误的是使用一个愚蠢的数据库驱动程序(MySQL),它默认在内存中读取整个结果集。 尝试使用http://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html中描述的useCursorFetch和defaultFetchSize属性来避免这种情况,并且您应该能够遍历行中没有取出内存中的所有内容(尽管未经过测试)。 注意这一行 System.out.println("output: " + ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)