创建可重新分发的django应用程序 [英] Creating a redistributable django app

查看:166
本文介绍了创建可重新分发的django应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java世界中,分发Web应用程序的常见方式是将其与Apache Tomcat进行打包。
使用Django(或任何WSGI应用程序)实现类似的方法是什么?

In Java world, a common way to distribute a web app is to package it along with Apache Tomcat. What is the appropriate way to achieve something like that with Django (or any WSGI application for that matter)?

推荐答案

在django中分发应用程序有两个阵营。它也取决于您的意思是什么应用程序

There are two camps for distributing apps in django. It also depends on what you mean by apps.


  1. 如果你的意思是一个应用程序是django条款,如与项目分离的可插拔应用程序,那么最好使用setuptools打包这些可插拔应用程序。许多django的可插拔应用程序是这样分发的。例如:

  • Pinax
  • Satchmo

如果您已经有django项目运行,并且想要在许多其他项目中重新使用可插拔应用程序,第一种方法很方便。如果您正在构建非单片网络应用程序或内部应用程序/网站或可重用应用程序,这是非常好的。如果您自己管理项目和可插拔应用程序,也很方便。如果您想通过这种方式将应用程序销售给客户,这是一种不方便(因为您的项目和可插拔应用程序生活在不同的目录中)。有些人说他们对这种方法没有任何问题。

The first way is convenient if you already have django project running and you want to re-use those pluggable apps in many other projects. This is really good if you are building non-monolithic web application or an in-house application/websites or a reusable application . It's also convenient if you are managing your project and those pluggable apps by yourself. It's sort of inconvenient (to some extent) if you want to sell an apps to a customer with this kind of approach because your project and your pluggable apps lives in a different directories. Some people said that they don't have any issues with this approach.

如果您将应用程序销售给客户端,第二种方法会更方便,因为所有的应用程序在您的项目中,您只能在客户端提取您的项目。这种风格更经常被称为单片风格。 Java EE和Ruby on Rails具有单一的部署风格。当您在客户端时,您不需要一个接一个地安装您的可插拔应用程序(假设您不在项目中使用任何外部可插拔应用程序)。但是,如果您想在项目中重用这些小型应用程序,那么您也会遇到一些问题。如果您没有任何计划重新使用这些小型应用程序,那么这样就够了。

The second way would be more convenient if you are selling your apps to a client because all of the apps is inside your project and you would only extract your project when you are at the client side. This style is more often called the monolithic style. Java EE and Ruby on Rails have a monolithic deployment style. You wouldn't need to install your 'pluggable apps' one by one (assuming you don't use any external pluggable apps in your project) when you are at the client side. But again, you would have some issues if you want to reuse those small apps inside the projects. If you don't have any plan to re-use those small apps, then this way is good enough.

这篇关于创建可重新分发的django应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆