Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Django "ImportError: No module named hashcompat"

I'm learning python + Django by reading 《beginning django e-commerce》, after I have installed django-db-log, when running $python manage.py runserver, there is a problem.

Unhandled exception in thread started by <function wrapper at 0x02C28DB0>

 Traceback (most recent call last): 
  File "D:\Python27\lib\site-packages\django\utils\autoreload.py", line 93, in wrapper fn(*args, **kwargs) 
  File "D:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 92, in inner_run self.validate(display_num_errors=True) 
  File "D:\Python27\lib\site-packages\django\core\management\base.py", line 308, in validate num_errors = get_validation_errors(s, app) 
  File "D:\Python27\lib\site-packages\django\core\management\validation.py", line 34, in get_validation_errors for (app_name, error) in get_app_errors().items(): 
  File "D:\Python27\lib\site-packages\django\db\models\loading.py", line 166, in get_app_errors self._populate() File "D:\Python27\lib\site-packages\django\db\models\loading.py", line 75, in _populate self.load_app(app_name) 
  File "D:\Python27\lib\site-packages\django\db\models\loading.py", line 96, in load_app models = import_module('.models', app_name)
  File "D:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in import_module __import__(name) 
  File "build\bdist.win32\egg\djangodblog\models.py", line 9, in <module> 
  File "build\bdist.win32\egg\djangodblog\manager.py", line 23, in <module> 
  File "build\bdist.win32\egg\djangodblog\helpers.py", line 5, in <module>

ImportError: No module named hashcompat
like image 931
xufeng Avatar asked May 09 '13 14:05

xufeng


1 Answers

You are referring to an outdated manual. Module hashcompat was removed in Django 1.6, as you can read here.

Either install an older Django version (1.5 or previous) or get a more recent textbook. You can also manually fix your code by using Python builtins as advised in the removal notice, but for a beginner can be sort of a hassle :)

like image 123
Stefano Sanfilippo Avatar answered Sep 23 '22 19:09

Stefano Sanfilippo