2

目前我有一个带有 virtualenv 和 zc.buildout 的项目,但问题是当我想在生产服务器中部署这个应用程序时。我希望能够在生产服务器中部署应用程序而无需更改路径(相对于服务器)并且无需替换任何包等。

我怎样才能做到这一点 ?

4

1 回答 1

1

With the following structure:

repo/
    project/
        settings.py
    local/

And these settings:

#settings.py
import os
import sys

PROJECT_ROOT = os.path.dirname(__file__)
PROJECT_LOCAL = os.path.join(os.path.dirname(PROJECT_ROOT), 'local')

You can install anything in the local folder which is deployment specific, like your buildout and virtualenv and reach it through PROJECT_LOCAL. Of course you should ignore local/* in your versioning.

于 2012-11-10T07:44:00.993 回答