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

Juan Perez
PLUS
Juan Perez
Courses Plus Student 8,944 Points

Cant run manage.py with python3

Hello all,

Im having this small problem. I cant run my server (or manage.py commands) with python 3 which I know the tutorials here on Treehouse are based of. Would you think is the problem?

This is the error I get:

(elearn)   learning_site python3 manage.py runserver 0.0.0.0:8000
Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named 'django'

3 Answers

Juan Perez
PLUS
Juan Perez
Courses Plus Student 8,944 Points

Ziga Pregelj So this was my problem:

Because I have Python 2.7 also installled in my computer. I thought that when I got into Virtual Env using

$ python3 virtualenv <myvenv>

I was getting an error and could've access to Python 3. But when I went to the site you recommended me django girls I read that the only way to do it is with:

$ python3 -m venv <myvenv>

Thanks alot for your help!

Žiga Pregelj
Žiga Pregelj
18,126 Points

I had the same problem, i think the solution was to install django (pip install Django) to the same folder where my virtual environment is (mkvirtualenv)... anyway found this if you find it useful http://tutorial.djangogirls.org/en/django_installation/,

remeber that you need install virtual env before you install django and i think that django must be installed to that folder to work propely.

Juan Perez
Juan Perez
Courses Plus Student 8,944 Points

I think I found my problem. Ill trst it and give you a shout once I do. Thanks alot for the link.

Žiga Pregelj
Žiga Pregelj
18,126 Points

Im not running it with workspaces, but on windows command promt the command is:

python manage.py runserver 8000

It is easier for me to do everything with PYCharm IDE and cmd... Workspaces are a little buggy sometimes.

Juan Perez
Juan Perez
Courses Plus Student 8,944 Points

Yea, me neither. Im trying to run it on my machine. MacOSx el capitan. I have both versions of python installed.