如何更新我的Django版本?

时间:2022-06-12 02:26:31

I currently have it installed and it's running a website.

我目前安装了它,它正在运行一个网站。

http://www.djangoproject.com/download/ This is the new version. How do I upgrade it? (How do I install the new version over my current one?)

http://www.djangoproject.com/download/这是新版本。我该如何升级? (如何在当前版本上安装新版本?)

2 个解决方案

#1


5  

read about this in :

在下面阅读:

http://docs.djangoproject.com/en/dev/topics/install/

For installing Django to be able to update to the latest code in trunk:

If you'd like to be able to update your Django code occasionally with the latest bug fixes and improvements, follow these instructions:

如果您希望能够使用最新的错误修复和改进偶尔更新Django代码,请按照以下说明操作:

1.Make sure that you have Subversion installed, and that you can run its commands from a shell. (Enter svn help at a shell prompt to test this.)

1.确保已安装Subversion,并且可以从shell运行其命令。 (在shell提示符下输入svn help来测试它。)

2.Check out Django's main development branch (the 'trunk') like so:

2.查看Django的主要开发分支('trunk'),如下所示:

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk 3.Next, make sure that the Python interpreter can load Django's code. There are various ways of accomplishing this. One of the most convenient, on Linux, Mac OSX or other Unix-like systems, is to use a symbolic link:

svn co http://code.djangoproject.com/svn/django/trunk/django-trunk 3.接下来,确保Python解释器可以加载Django的代码。有各种方法来实现这一点。在Linux,Mac OSX或其他类Unix系统上最方便的一种是使用符号链接:

ln -s pwd/django-trunk/django SITE-PACKAGES-DIR/django (In the above line, change SITE-PACKAGES-DIR to match the location of your system's site-packages directory, as explained in the "Where are my site-packages stored?" section above.)

ln -s pwd / django-trunk / django SITE-PACKAGES-DIR / django(在上面的行中,更改SITE-PACKAGES-DIR以匹配系统的site-packages目录的位置,如“我的网站在哪里”中所述 - 包存储?“上面的部分。)

Alternatively, you can define your PYTHONPATH environment variable so that it includes the django-trunk directory. This is perhaps the most convenient solution on Windows systems, which don't support symbolic links. (Environment variables can be defined on Windows systems from the Control Panel.)

或者,您可以定义PYTHONPATH环境变量,使其包含django-trunk目录。这可能是Windows系统上最方便的解决方案,它不支持符号链接。 (可以在“控制面板”的Windows系统上定义环境变量。)

What about Apache and mod_python?

Apache和mod_python怎么样?

If you take the approach of setting PYTHONPATH, you'll need to remember to do the same thing in your Apache configuration once you deploy your production site. Do this by setting PythonPath in your Apache configuration file.

如果您采用设置PYTHONPATH的方法,那么在部署生产站点后,您需要记住在Apache配置中执行相同的操作。通过在Apache配置文件中设置PythonPath来完成此操作。

More information about deployment is available, of course, in our How to use Django with mod_python documentation.

当然,有关部署的更多信息可以在我们的如何使用Django和mod_python文档中找到。

4.On Unix-like systems, create a symbolic link to the file django-trunk/django/bin/django-admin.py in a directory on your system path, such as /usr/local/bin. For example:

4.在类Unix系统上,在系统路径的目录中创建指向文件django-trunk / django / bin / django-admin.py的符号链接,例如/ usr / local / bin。例如:

ln -s pwd/django-trunk/django/bin/django-admin.py /usr/local/bin This simply lets you type django-admin.py from within any directory, rather than having to qualify the command with the full path to the file.

ln -s pwd / django-trunk / django / bin / django-admin.py / usr / local / bin这只是让你从任何目录中键入django-admin.py,而不是必须用完整路径限定命令到文件。

On Windows systems, the same result can be achieved by copying the file django-trunk/django/bin/django-admin.py to somewhere on your system path, for example C:\Python24\Scripts.

在Windows系统上,通过将文件django-trunk / django / bin / django-admin.py复制到系统路径上的某个位置,可以实现相同的结果,例如C:\ Python24 \ Scripts。

You don't have to run python setup.py install, because you've already carried out the equivalent actions in steps 3 and 4.

您不必运行python setup.py install,因为您已经在步骤3和4中执行了等效的操作。

When you want to update your copy of the Django source code, just run the command svn update from within the django-trunk directory. When you do this, Subversion will automatically download any changes

如果要更新Django源代码的副本,只需从django-trunk目录中运行命令svn update。执行此操作时,Subversion将自动下载任何更改

For updating Django from stable release to another stable release:

If you are upgrading your installation of Django from a previous version, you will need to uninstall the old Django version before installing the new version.

如果要从先前版本升级Django的安装,则需要在安装新版本之前卸载旧的Django版本。

If you installed Django using setup.py install, uninstalling is as simple as deleting the django directory from your Python site-packages.

如果您使用setup.py install安装了Django,卸载就像从Python站点包中删除django目录一样简单。

If you installed Django from a Python egg, remove the Django .egg file, and remove the reference to the egg in the file named easy-install.pth. This file should also be located in your site-packages directory.

如果您从Python egg安装了Django,请删除Django .egg文件,并删除名为easy-install.pth的文件中对egg的引用。此文件也应位于site-packages目录中。

#2


5  

First of all, don't. Install/upgrade it on your staging server first and test your app to make sure that it still works. Only after complete testing should you cut over to the new version on your production website.

首先,不要。首先在您的临时服务器上安装/升级它并测试您的应用程序以确保它仍然有效。只有在完成测试后,才能切换到生产网站上的新版本。

#1


5  

read about this in :

在下面阅读:

http://docs.djangoproject.com/en/dev/topics/install/

For installing Django to be able to update to the latest code in trunk:

If you'd like to be able to update your Django code occasionally with the latest bug fixes and improvements, follow these instructions:

如果您希望能够使用最新的错误修复和改进偶尔更新Django代码,请按照以下说明操作:

1.Make sure that you have Subversion installed, and that you can run its commands from a shell. (Enter svn help at a shell prompt to test this.)

1.确保已安装Subversion,并且可以从shell运行其命令。 (在shell提示符下输入svn help来测试它。)

2.Check out Django's main development branch (the 'trunk') like so:

2.查看Django的主要开发分支('trunk'),如下所示:

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk 3.Next, make sure that the Python interpreter can load Django's code. There are various ways of accomplishing this. One of the most convenient, on Linux, Mac OSX or other Unix-like systems, is to use a symbolic link:

svn co http://code.djangoproject.com/svn/django/trunk/django-trunk 3.接下来,确保Python解释器可以加载Django的代码。有各种方法来实现这一点。在Linux,Mac OSX或其他类Unix系统上最方便的一种是使用符号链接:

ln -s pwd/django-trunk/django SITE-PACKAGES-DIR/django (In the above line, change SITE-PACKAGES-DIR to match the location of your system's site-packages directory, as explained in the "Where are my site-packages stored?" section above.)

ln -s pwd / django-trunk / django SITE-PACKAGES-DIR / django(在上面的行中,更改SITE-PACKAGES-DIR以匹配系统的site-packages目录的位置,如“我的网站在哪里”中所述 - 包存储?“上面的部分。)

Alternatively, you can define your PYTHONPATH environment variable so that it includes the django-trunk directory. This is perhaps the most convenient solution on Windows systems, which don't support symbolic links. (Environment variables can be defined on Windows systems from the Control Panel.)

或者,您可以定义PYTHONPATH环境变量,使其包含django-trunk目录。这可能是Windows系统上最方便的解决方案,它不支持符号链接。 (可以在“控制面板”的Windows系统上定义环境变量。)

What about Apache and mod_python?

Apache和mod_python怎么样?

If you take the approach of setting PYTHONPATH, you'll need to remember to do the same thing in your Apache configuration once you deploy your production site. Do this by setting PythonPath in your Apache configuration file.

如果您采用设置PYTHONPATH的方法,那么在部署生产站点后,您需要记住在Apache配置中执行相同的操作。通过在Apache配置文件中设置PythonPath来完成此操作。

More information about deployment is available, of course, in our How to use Django with mod_python documentation.

当然,有关部署的更多信息可以在我们的如何使用Django和mod_python文档中找到。

4.On Unix-like systems, create a symbolic link to the file django-trunk/django/bin/django-admin.py in a directory on your system path, such as /usr/local/bin. For example:

4.在类Unix系统上,在系统路径的目录中创建指向文件django-trunk / django / bin / django-admin.py的符号链接,例如/ usr / local / bin。例如:

ln -s pwd/django-trunk/django/bin/django-admin.py /usr/local/bin This simply lets you type django-admin.py from within any directory, rather than having to qualify the command with the full path to the file.

ln -s pwd / django-trunk / django / bin / django-admin.py / usr / local / bin这只是让你从任何目录中键入django-admin.py,而不是必须用完整路径限定命令到文件。

On Windows systems, the same result can be achieved by copying the file django-trunk/django/bin/django-admin.py to somewhere on your system path, for example C:\Python24\Scripts.

在Windows系统上,通过将文件django-trunk / django / bin / django-admin.py复制到系统路径上的某个位置,可以实现相同的结果,例如C:\ Python24 \ Scripts。

You don't have to run python setup.py install, because you've already carried out the equivalent actions in steps 3 and 4.

您不必运行python setup.py install,因为您已经在步骤3和4中执行了等效的操作。

When you want to update your copy of the Django source code, just run the command svn update from within the django-trunk directory. When you do this, Subversion will automatically download any changes

如果要更新Django源代码的副本,只需从django-trunk目录中运行命令svn update。执行此操作时,Subversion将自动下载任何更改

For updating Django from stable release to another stable release:

If you are upgrading your installation of Django from a previous version, you will need to uninstall the old Django version before installing the new version.

如果要从先前版本升级Django的安装,则需要在安装新版本之前卸载旧的Django版本。

If you installed Django using setup.py install, uninstalling is as simple as deleting the django directory from your Python site-packages.

如果您使用setup.py install安装了Django,卸载就像从Python站点包中删除django目录一样简单。

If you installed Django from a Python egg, remove the Django .egg file, and remove the reference to the egg in the file named easy-install.pth. This file should also be located in your site-packages directory.

如果您从Python egg安装了Django,请删除Django .egg文件,并删除名为easy-install.pth的文件中对egg的引用。此文件也应位于site-packages目录中。

#2


5  

First of all, don't. Install/upgrade it on your staging server first and test your app to make sure that it still works. Only after complete testing should you cut over to the new version on your production website.

首先,不要。首先在您的临时服务器上安装/升级它并测试您的应用程序以确保它仍然有效。只有在完成测试后,才能切换到生产网站上的新版本。