0

I initially had python 3.4 installed with django 1.65. But i searched and found out Django registration doesn't work with python 3. So I downloaded python 2.78 and even uninstalled python 3.4.

However When i am on url http://www.localhost:8000/accounts/register/ and try to register a user an error comes up. It seems like its django registration is still reading my old virtual env linked to python 3.4 and its path. I have edited my environmental variable PATH to delete any Python 3.4 and replaced with Python 2.7. But still same error occurs. I'm new to web development. Sorry if I didn't provide enough detail or to little detail.

TypeError at /accounts/register/
Unicode-objects must be encoded before hashing
Request Method: POST
Request URL:    http://127.0.0.1:8000/accounts/register/
Django Version: 1.6.5
Exception Type: TypeError
Exception Value:    
Unicode-objects must be encoded before hashing
Exception Location: C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\registration\models.py in create_profile, line 106
Python Executable:  C:\Users\jasan\virtual_enc_matchmaker\Scripts\pythonw.exe
Python Version: 3.4.1
Python Path:    
['C:\\Users\\jasan\\PycharmProjects\\matchmaker',
 'C:\\Users\\jasan\\PycharmProjects\\matchmaker',
 'C:\\WINDOWS\\SYSTEM32\\python34.zip',
 'C:\\Python34\\DLLs',
 'C:\\Python34\\lib',
 'C:\\Python34',
 'C:\\Users\\jasan\\virtual_enc_matchmaker',
 'C:\\Users\\jasan\\virtual_enc_matchmaker\\lib\\site-packages']

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/register/

Django Version: 1.6.5
Python Version: 3.4.1
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'profiles',
 'south',
 'registration',
 'PIL',
 'stripe')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\django\core\handlers\base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\django\views\generic\base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\registration\views.py" in dispatch
  79.         return super(RegistrationView, self).dispatch(request, *args, **kwargs)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\django\views\generic\base.py" in dispatch
  87.         return handler(request, *args, **kwargs)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\registration\views.py" in post
  35.             return self.form_valid(request, form)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\registration\views.py" in form_valid
  82.         new_user = self.register(request, **form.cleaned_data)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\registration\backends\default\views.py" in register
  80.                                                                     password, site)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\django\db\transaction.py" in inner
  431.                 return func(*args, **kwargs)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\registration\models.py" in create_inactive_user
  88.         registration_profile = self.create_profile(new_user)
File "C:\Users\jasan\virtual_enc_matchmaker\lib\site-packages\registration\models.py" in create_profile
  106.         salt = hashlib.sha1(str(random.random())).hexdigest()[:5]

Exception Type: TypeError at /accounts/register/
Exception Value: Unicode-objects must be encoded before hashing
Chillar Anand
  • 27,936
  • 9
  • 119
  • 136
jasan
  • 11,475
  • 22
  • 57
  • 97
  • Welcome to StackOverflow. You may want to format your question to make it more readable. As it is, it's hard to tell exactly what your big block of code has to do with your question. Try adding punctuation, sentences and paragraphs as well as removing the bold from your problem statement as well. – JamesENL Jul 09 '14 at 04:59
  • You can try to add this two lines to check where is your python executable `import sys` `print sys.executable` – trnsnt Jul 09 '14 at 06:20
  • thanks for the reply I actually deleted the virtual environment that was linked to python34 and using your command its shows the python27 path for the executable.but i get different error socket.error: [Errno 10013]. I am using windows 7 and pycharm. I might just post this a new question. – jasan Jul 09 '14 at 07:38

0 Answers0