简体   繁体   English

从Django 1.3升级到1.5

[英]Upgrading from Django 1.3 to 1.5

I'd like to upgrade an existing application to a more recent version of django. 我想将现有应用程序升级到django的最新版本。 In 1.4 they changed the password hashing algorithm such that all my old passwords will no longer match when people try to login. 在1.4中,他们更改了密码哈希算法,以便当人们尝试登录时,我所有的旧密码都不再匹配。 Is there some way to upgrade but not require users to reset their passwords? 有什么方法可以升级但不要求用户重设密码吗?

according to https://docs.djangoproject.com/en/dev/topics/auth/passwords/#auth-password-storage it will still check everything as usual. 根据https://docs.djangoproject.com/en/dev/topics/auth/passwords/#auth-password-storage,它仍会像往常一样检查所有内容。

if you are worried about storing everything as SHA1 by default, then put the hasher first in the list (this is not recommended though). 如果您担心默认情况下将所有内容存储为SHA1 ,则将哈希器放在列表的第一位(不过不建议这样做)。

# settings.py
PASSWORD_HASHERS = (
    'django.contrib.auth.hashers.SHA1PasswordHasher',
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
    ...
)

if you need to check for yourself, you can consider using virtualenv with the newer django==1.5 package and create a dummy project/app connected to the same database to try it out. 如果需要自己检查,可以考虑将virtualenv与较新的django==1.5软件包一起使用,并创建一个连接到同一数据库的虚拟项目/应用程序以进行尝试。 If you have admin privileges and already use the admin interface, you can use that to login there. 如果您具有管理员权限,并且已经使用管理员界面,则可以使用该界面登录。

I did the same upgrade last month and Django passwords still fully functional. 我上个月进行了相同的升级,并且Django密码仍然可以正常使用。 The changes I made are basically in generic views( now all generic views are class based) , The logging in settings.py was changed and I have to put a ALLOWED_HOSTS list. 我所做的更改基本上是在通用视图中(现在所有通用视图都是基于类的),settings.py中的登录已更改,我必须放置ALLOWED_HOSTS列表。 For example: ALLOWED_HOSTS = ['.stackoverflow.com'] 例如: ALLOWED_HOSTS = ['.stackoverflow.com']

Particularly, I changed my urls calls cause I was using named urls without quotes in url tags and it's no longed supported by django. 特别是,我更改了urls调用,因为我使用的是url标记中没有引号的url,django不再支持它。 The right way is like this: {% url 'name_of_the_view' arg1 arg2%} 正确的方式是这样的: {% url 'name_of_the_view' arg1 arg2%}

I suggest you to create another environment and try use django 1.5 just making this small changes. 我建议您创建另一个环境,并尝试使用django 1.5进行一些小的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM