Skip to content
Advertisement

How to create a user in Django?

I’m trying to create a new User in a Django project by the following code, but the highlighted line fires an exception.

JavaScript

Any help?

Advertisement

Answer

The correct way to create a user in Django is to use the create_user function. This will handle the hashing of the password, etc..

JavaScript
Advertisement