[英]Best practice in updating Django web app content when deployed on Heroku
I'm finally at the stage of deploying my Django web-app on Heroku.我终于处于在 Heroku 上部署我的 Django 网络应用程序的阶段。 The web-app retrieves and performs financial analysis on a subset of public companies.
该网络应用程序检索并执行对部分上市公司的财务分析。 Most of the content of the web-app is stored in.csv and.xslx files.
web-app的大部分内容存储在.csv和.xslx文件中。 There's a master.xslx file that I need to open and manually update on a daily basis.
我需要每天打开并手动更新一个 master.xslx 文件。 Then I run scripts which based on info in that.xsls file retrieve financial data, news, etc and store the data in.csv files.
然后我运行基于 that.xsls 文件中的信息的脚本检索财务数据、新闻等,并将数据存储在.csv 文件中。 Then my Django views and html templates are referring to those files (and not to a sql/postgress database).
然后我的 Django 视图和 html 模板引用这些文件(而不是 sql/postgress 数据库)。 This is my setup in a nutshell.
简而言之,这是我的设置。
Now I'm wondering what is the best way to make this run smoothly in production.现在我想知道什么是让它在生产中顺利运行的最佳方法。
I'd highly appreciate any advice on this matter.我非常感谢您对此事的任何建议。
You need to perform a trade-off between easy of use (access/update the source XSLX file) and maintainability (storing safely and efficiently the data).您需要在易用性(访问/更新源 XSLX 文件)和可维护性(安全有效地存储数据)之间进行权衡。
Option #1 is more convenient if you need to quickly open and change the file using your Excel/Numbers application.如果您需要使用 Excel/Numbers 应用程序快速打开和更改文件,选项 #1会更方便。 On the other hand your application needs to access physical files to perform the logic and render the views.
另一方面,您的应用程序需要访问物理文件以执行逻辑并呈现视图。
BTW some time ago I have created a repository Heroku Files to present some options in terms of using external files.顺便说一句,前段时间我创建了一个存储库Heroku 文件,以提供一些使用外部文件的选项。
Option #2 is typically better from a design point of view: the data is organised in the database and can be more efficiently queried and manipulated.从设计的角度来看,选项 #2通常更好:数据在数据库中组织,可以更有效地查询和操作。 The challenge in this case is that you need a way to view/edit the data, and this normally requires more development (creating new screens, etc..)
这种情况下的挑战是您需要一种查看/编辑数据的方法,这通常需要更多的开发(创建新屏幕等)
Involving a database is normally the preferred approach as you can scale up to large dataset without problems (which is not the case with files).涉及数据库通常是首选方法,因为您可以毫无问题地扩展到大型数据集(文件不是这种情况)。 On the other hand if the XLS file stays small and you only need simple (quick) updates your current architecture can work.
另一方面,如果 XLS 文件很小并且您只需要简单(快速)更新您当前的架构就可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.