Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Django does not store passwords as plain-text. It first hashes them and them stores the hash. So when the user logs in, Django applies the same hash function to the users input and then compares the two hashes - from users input and what is stored in the db.</p> <p>However to make things more flexible, Django does not store password hashes, well it does but in addition, it also stores the algorithm by which the hash was generated. Imagine this scenario - you use hash function <code>X</code> to generate password hashes, but then you realize that that function is no longer secure for whatever reason and you switch to hashing function <code>Y</code>. That however is a problem because at point, whoever's password hash is stored using function <code>X</code>, they would not be able to login anymore. That is why Django also stores the method by which the has was generated, in addition to the hash value itself. This is where <code>PASSWORD_HASHERS</code> setting comes in. The fact that Django stores the method by which the hash is generated in the db, when reading the value, it does not really tell Django as to how to execute the hash function itself. So <code>PASSWORD_HASHERS</code> is sort of like a mapper between the hashing Python function (actually a class but anyway...) and the value stored in the db.</p> <p>So back to your question. The error message means that Django is not aware of the hashing function <code>password</code> which was used to store the hash of the password in your database, or at least its not in the <code>PASSWORD_HASHERS</code>.</p> <p>I can think of couple of reasons why that might happen.</p> <ul> <li><p>Make sure that then you do <code>syncdb</code>, it uses the same <code>settings.py</code> file as when you are running the server to access the admin. It might be the case that different settings are used.</p></li> <li><p>However developers usually do not modify <code>PASSWORD_HASHERS</code> in the <code>settings.py</code> and just use the default value. In that case, make sure you are using the same Python with the same installed version of Django when you do <code>syncdb</code> and when you run the server. If you do <code>syncdb</code> in one virtualenv, for example, and run server in different env, then Django versions might be different, hence they might have different settings for <code>PASSWORD_HASHERS</code> and therefore where you run <code>syncdb</code>, it might be using a hashing function which is not defined when you run the server.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload