Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django ORM Same Old ORM django-debug-toolbar

Greg Kaleka
Greg Kaleka
39,021 Points

Manage.py no longer working

After installing django-debug-toolbar, when I run python manage.py, with or without arguments, I get the following Traceback:

Traceback (most recent call last):                            
  File "manage.py", line 8, in <module>                       
    from django.core.management import execute_from_command_li
ne                                                            
  File "/home/treehouse/.local/lib/python3.5/site-packages/dja
ngo/__init__.py", line 3, in <module>                         
    from django.utils.version import get_version              
ImportError: No module named 'django.utils'

Looking in the __init__.py file in question:

__init__.py
from __future__ import unicode_literals                       

from django.utils.version import get_version                  

VERSION = (1, 11, 4, 'final', 0)                              

__version__ = get_version(VERSION)                            

# more below - I'm truncating it here

Any idea why python can't find django.utils anymore?

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi! I received your request for assistance, however, I have not taken this course (yet). But I did do some digging around. It seems that django.utils.version doesn't really exist. Take a look at the django documentation. As you'll see that module is not listed at all.

My instinct is to say that there is likely an incompatibility between your version of django and your version of Python. Also, interesting to note, it seems workspaces is running 1.9.9.

I'd be interested to know what would happen if you commented out that import line and changed the version part to __version__ = django.get_version(VERSION)

Let me know if any of this was helpful! :sparkles:

Chris Freeman
Chris Freeman
Treehouse Moderator 68,454 Points

I was able to find the module code under django/utils/version.py

And a usage example under the latest version django module code.

I suspect that the module search is not working properly or the current environment can not find the version.py module.

Does the directory "/home/treehouse/.local/lib/python3.5/site-packages/django/utils" exist? Does it contain the file version.py?

1 Answer

Greg Kaleka
Greg Kaleka
39,021 Points

Hey thanks both - something weird happened to my django installation in workspaces, and utils wasn't there at all. I upgraded django with pip install -U django, and it's working now. I'm pretty sure it wasn't a version issue, but rather some file corruption or something, which a fresh install fixed.

Appreciate the help!