Django 的最佳部署配置是什么?
我将在服务器上部署我的 django 项目。为此我计划进行以下优化。
- 我想知道的是我错过了什么吗?
- 我怎样才能更好地做到这一点?
前端:
- Django-static (用于压缩静态媒体)
- 从 CDN
- 缓存控制标头
- 运行 jquery索引 Django 数据库(对于某些型号)
服务器端:
I will be deploying my django project on the server. For that purpose I plan on doing the following optimization.
- What i would like to know is that am I missing something?
- How can I do it in a better manner?
Front-end:
- Django-static (For compressing static media)
- Running jquery from CDN
- Cache control for headers
- Indexing the Django db (For certain models)
Server side:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些是我经常使用的一些优化:
前端:
使用js加载库,例如labjs,requirejs 或 yepnope。您仍然应该压缩/合并 js 文件,但在大多数用例中,最好向多个 js 文件发出多个请求并并行运行它们,以便在每个页面上运行 1 个巨大的 js 文件。我总是将它们分成几组,以平衡请求和并行加载。有些还允许条件加载和故障转移(即,如果由于某种原因,您的 cdn'd jquery 不再存在)
在可能的情况下使用精灵。
后端:
These are some optimization I use on a regular basis:
frontend:
Use a js loading library like labjs, requirejs or yepnope. You should still compress/merge your js files, but in most use cases it seems to be better to make several requests to several js files and run them in parallel as to have 1 huge js file to run on each page. I always split them up in groups that make sense to balance requests and parellel loading. Some also allow for conditional loading and failovers (i.e. if for some reason, your cdn'd jquery is not there anymore)
Use sprites where posible.
Backend:
如果您需要支持异步和异步,可以选择安装 Celery。期间任务。如果这样做,请考虑安装 Redis 而不是 Memcached。使用 Redis,您可以管理会话并执行 Celery 操作以及缓存。
看看这里: http://unfoldthat.com/2011/09 /14/try-redis-instead.html
An option may be installing Celery if you need to support asynchronous & period tasks. If you do so, consider installing Redis instead of Memcached. Using Redis you can manage sessions and carry out Celery operations as well as do caching.
Take a look at here: http://unfoldthat.com/2011/09/14/try-redis-instead.html