将 Django 从 1.1 升级到 1.2

发布于 2024-10-06 18:03:28 字数 2945 浏览 5 评论 0原文

我有一个安装了 Nginx 和 Django 1.1 的 Ubuntu 服务器。在开发人员的本地,他有 1.2,它有一些功能(智能 if),现在在我的开发服务器上被破坏。我需要升级到1.2。

这几乎是我参与的第一个真正的 django/python 项目,所以我正在摸索着进入它。我想做的就是升级。该应用程序中使用了很多额外的软件包,例如南、分页、注册等...

/var/www/env/example.com/lib/python2.6/site-packages

我不是最初安装它的人。这就是我在该文件夹中看到的内容。

/var/www/env/example.com/lib/python2.6/site-packages$ ls
Crypto                               django                                pycrypto-2.0.1-py2.6.egg-info
Django-1.1.1-py2.6.egg-info          django-avatar.egg-link                     registration
Fabric-0.9.0-py2.6.egg-info          django_avatar-1.0.5-py2.6.egg-info         setuptools-0.6c9-py2.6.egg
MySQL_python-1.2.3c1-py2.6.egg-info  django_countries                           setuptools.pth
MySQLdb                              django_countries-1.0.4-py2.6.egg-info      simplejson
PIL                                  django_debug_toolbar-0.8.3-py2.6.egg-info  simplejson-2.1.1-py2.6.egg-info
PIL.pth                              django_pagination-1.0.7-py2.6.egg-info     south
South-0.7.2-py2.6.egg-info           django_registration-0.7-py2.6.egg-info     stdimage
_mysql.so                            easy-install.pth                           virtualenvwrapper
_mysql_exceptions.py                 example                                    virtualenvwrapper-1.25-py2.6.egg-info
_mysql_exceptions.pyc                fabric                                     yolk
avatar                               pagination                                 yolk- 0.4.1-py2.6.egg-info
debug_toolbar                        paramiko

现在文档提到了如果使用 Egg 安装的话,与手动安装相比,有不同的升级过程吗?

我确实在这里看到了 Egg 文件,那么我该如何继续将 Django 1.1 升级到 1.2。

Virtualenv

我们使用 virtualenv 为站点创建一个“容器”。即我们可以使用一组与系统使用不同的模块。

在本地文档中提到了这一点

我们使用 pip 来安装模块:

这需要在 virtualenv 之外运行(即当我们在提示符中没有 example.com 时)

$ pip -E /var/www/env/example.com install <modulename>

所以我可以使用 pip 安全升级 Django 或者什么这是我升级的最佳方式吗?

$yolk -l
Django          - 1.1.1        - active  
Fabric          - 0.9.0        - active
MySQL-python    - 1.2.3c1      - active
PIL             - 1.1.7        - active
Python          - 2.6.4rc2     - active development (/usr/lib/python2.6/lib-dynload)
South           - 0.7.2        - active
django-avatar   - 1.0.5        - non-active
django-avatar   - 1.1a5        - active development (/var/www/env/example.com/src/avatar)
django-countries - 1.0.4        - active
django-debug-toolbar - 0.8.3        - active
django-pagination - 1.0.7        - active
django-registration - 0.7          - active
pycrypto        - 2.0.1        - active
setuptools      - 0.6c9        - active
simplejson      - 2.1.1        - active
virtualenvwrapper - 1.25         - active
wsgiref         - 0.1.2        - active development (/usr/lib/python2.6)
yolk            - 0.4.1        - active

I've an Ubuntu server with Nginx and Django 1.1 installed. On the developer's local he had 1.2 and it has some features (smart if) that are breaking now on my dev server. I need to upgrade to 1.2.

This is pretty much my first proper django/python project I'm involved in so I'm feeling my way into it. What I want to do is upgrade. There are a lot of extra packages that are used in the app e.g. south, pagination, registration etc...

/var/www/env/example.com/lib/python2.6/site-packages

I wasn't the one who originally installed it. this is what i see in that folder.

/var/www/env/example.com/lib/python2.6/site-packages$ ls
Crypto                               django                                pycrypto-2.0.1-py2.6.egg-info
Django-1.1.1-py2.6.egg-info          django-avatar.egg-link                     registration
Fabric-0.9.0-py2.6.egg-info          django_avatar-1.0.5-py2.6.egg-info         setuptools-0.6c9-py2.6.egg
MySQL_python-1.2.3c1-py2.6.egg-info  django_countries                           setuptools.pth
MySQLdb                              django_countries-1.0.4-py2.6.egg-info      simplejson
PIL                                  django_debug_toolbar-0.8.3-py2.6.egg-info  simplejson-2.1.1-py2.6.egg-info
PIL.pth                              django_pagination-1.0.7-py2.6.egg-info     south
South-0.7.2-py2.6.egg-info           django_registration-0.7-py2.6.egg-info     stdimage
_mysql.so                            easy-install.pth                           virtualenvwrapper
_mysql_exceptions.py                 example                                    virtualenvwrapper-1.25-py2.6.egg-info
_mysql_exceptions.pyc                fabric                                     yolk
avatar                               pagination                                 yolk- 0.4.1-py2.6.egg-info
debug_toolbar                        paramiko

Now the docs mention something about if installed using egg there is a different upgrade process to if it's installed manually?

I do see mention of egg files here so how do I proceed to upgrade Django 1.1 to 1.2.

Virtualenv

We use virtualenv to create a "container" for the site. i.e. so we can use a separate set of modules than the system uses.

In the local docs this is mentioned

We use pip to install modules:

This needs to be run outside of the virtualenv (i.e. when we don't have the example.com in the prompt)

$ pip -E /var/www/env/example.com install <modulename>

So Can I use pip to safely upgrade Django or what is my best way to upgrade?

$yolk -l
Django          - 1.1.1        - active  
Fabric          - 0.9.0        - active
MySQL-python    - 1.2.3c1      - active
PIL             - 1.1.7        - active
Python          - 2.6.4rc2     - active development (/usr/lib/python2.6/lib-dynload)
South           - 0.7.2        - active
django-avatar   - 1.0.5        - non-active
django-avatar   - 1.1a5        - active development (/var/www/env/example.com/src/avatar)
django-countries - 1.0.4        - active
django-debug-toolbar - 0.8.3        - active
django-pagination - 1.0.7        - active
django-registration - 0.7          - active
pycrypto        - 2.0.1        - active
setuptools      - 0.6c9        - active
simplejson      - 2.1.1        - active
virtualenvwrapper - 1.25         - active
wsgiref         - 0.1.2        - active development (/usr/lib/python2.6)
yolk            - 0.4.1        - active

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半边脸i 2024-10-13 18:03:28

pip -E /var/www/env/example.com install --upgrade django 将正常工作并升级 django 安装,但是您可能需要阅读 django 1.2 的发行说明并注意任何可能破坏您的代码的向后不兼容的更改。此外,您可能希望首先在开发服务器上执行此操作,并在部署之前运行您可能进行的任何测试,因为您拥有的任何依赖于内部 api 或实现的代码可能会变得无效。

我并不是想吓跑您,恰恰相反:1.2 是一个很棒的版本!在将任何东西投入生产之前,请务必遵循标准测试程序;)

pip -E /var/www/env/example.com install --upgrade django will work properly and upgrade the django installation, however you may want to read the release notes for django 1.2 and be aware of any backwards incompatible changes that may break your code. Also, you may want to do this on a dev server first and run any tests you may have before deployment as any code you have that relies on internal api or implementation may become invalid.

I'm not trying to scare you off, quite the opposite: 1.2 is a great release! Just be sure to follow standard testing procedure before putting anything into production ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文