Re: tutorial first step. -ImportError: No module named django.core-

1461 views
Skip to first unread message

Elena Williams

unread,
Nov 3, 2012, 10:06:52 PM11/3/12
to django...@googlegroups.com
Hi Francesco,

What you're seeing is the most basic django/python error. It means that your python can't find django from your current path.

You should start by checking for the simple things.

What happens when you try putting the following in your terminal?:
$ python

and then:
>>> import django

Also where is your django-admin.py file located? 

Elena :)


---
Elena :)
@elequ
04022 90172



On Sun, Nov 4, 2012 at 6:24 AM, Francescos <serafini....@gmail.com> wrote:
Hello everyone,
Following the django tut I've sat up all the installation and reached the step where I had to run the command: django-admin.py startproject mysite
result: I receive the error specified in the subject.
I installed virtualenv (as said here) and activate it before running the command django-admin.py startproject mysite.
Any suggestion for this problem? Thanks everyone.
Configuration:
- Windows 7 & cmd.exe
- Python2.7
- virtualenviroment at: C:\Python27\fra_env\
PATH contains: C:\Python27\fra_env\Scripts
- django-admin.py is in C:\Python27\fra_env\Scripts AND C:\Python27\fra_env\Lib\site-packages\django\bin

I hope someone can help me!
Francesco

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/v_l9HV306cIJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Francescos

unread,
Nov 4, 2012, 9:19:03 AM11/4/12
to django...@googlegroups.com
Hi Elena,

Thanks for replying.
I guess the PATH var is well set. In fact, if I hit python into cmd.exe and then import django everything work (I can print the django version, as well).
So, Django is installed and reachable apparently. At this point I guess there is a problem in looking for the modules..
I also guess is important to consider that I am using virtualenv that, once activated, it adds to the PATH this: C:\Python27\fran_env\Scripts where is located django-admin.py. This file is also located here: C:\Python27\fra_env\Lib\site-packages\django\bin

Francesco

Elena Williams

unread,
Nov 5, 2012, 7:53:15 AM11/5/12
to django...@googlegroups.com
Hi Francesco,

What happens when you try:

$ cd C:\Python27\fra_env\

(or whatever the equivalent of this might be in the shell you are using)

$ python Scripts\django-admin.py startproject mysite

Regards,
Elena :)



To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kmyIAnk7cYcJ.

Francesco Serafini

unread,
Nov 7, 2012, 6:24:16 AM11/7/12
to django...@googlegroups.com
Hi Elena,

Thanks for your replies.
Sorry, but in the end I started a new installation without virtualenv because I was curious about django and I didn't want to wait.
When I will use again virtualenv (I know I'll do) I'll try again to do my best.
Thanks for you help, really!

Francesco


2012/11/5 Elena Williams <ele...@gmail.com>

Francescos

unread,
Nov 8, 2012, 3:29:28 AM11/8/12
to django...@googlegroups.com
Good good!
So, this means I was executing the wrong django-admin.py file.
Daniel, I'm curious about your question, too. Because I though that activating virtualenv the path is automatically set to the specified environment and then no need to include the right django-admin.py file into some environment variable...
Anyway, maybe a solution for you is to put, possibly at the beginning, your django-admin.py path into the PATH variable.
Elena we need you... :D

Francesco

On Thursday, November 8, 2012 3:26:36 AM UTC, Daniel wrote:
Hi Elena, I actually had the exact same problem Francesco was having.  I wasn't able to start a project, and then I tried your question.  The cmd line went something like this:

(env) path/to/directory/python env/Scripts/django-admin.py startproject newproject

It worked!  While I'm happy with the result, I'd like to keep projects in the root folder, and typing out the path to django-admin.py every time seems like quite a hassle.  Is there a way to point to the file without having to specify its location?  All the tutorials and such that I've seen online simply use the django-admin.py startproject (name) convention and it works fine.

Dan

Elena Williams

unread,
Nov 8, 2012, 5:20:37 AM11/8/12
to django...@googlegroups.com
Francesco and Daniel,

This is an interesting problem with the tutorial! We will have to make sure that it's changed -- obviously the tutorial needs to be clearer!

Any suggestions you guys have about how/where we could insert some information that could make this clearer please point out where it'd be helpful or better yet write some words (community for-the-win! :) 

Daniel: in response to what you were saying about the location of `django-admin.py` being a hassle I remember when I was learning be concerned by this also! But turns out that nowadays actually I rarely use `django-admin.py` but usually in my set-up keep a copy of it at `~/code/bin/` with a bunch of other useful bits-and-pieces (though this approach is a bit out-dated with virtualenv). Besides starting a new whole project is a pretty big deal (compared to most dev work) and personally I think needing to find django-admin.py for it makes it seem as special as it is.

---
Elena :)
@elequ


To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/-CfEO2H-RHsJ.

Francesco Serafini

unread,
Nov 8, 2012, 10:00:18 AM11/8/12
to django...@googlegroups.com
Elena,

I think the place where should be put a warning about which django-admin.py script has to be run is here. Hence when the reader is going to install virtualenv.
Hoping this help

Franz


2012/11/8 Elena Williams <ele...@gmail.com>

Daniel

unread,
Nov 8, 2012, 6:31:58 PM11/8/12
to django...@googlegroups.com
Francesco and Elena, 

I read up on virtualenv and to my understanding, what you said was right - that it sets the PATH for you just by using it.  One thing that I'm still not sure on, is that for Linux, you have to specify the 'source' command which will change the environment in place.  I'm not sure if this happens automatically on Windows or what.  As for the setting the PATH variable at the beginning, that seems like it may work, I'm just hesitant because that is used as a system-wide deal, whereas the virtualenv isn't.  The distinction eludes me.

In terms of typing out the path for the admin file, I guess it's not really that big of a deal, since I won't be making many projects in the near future, I just thought there might be a quick fix available.  Thanks for the input!

Dan

Dan Gentry

unread,
Nov 9, 2012, 9:28:59 AM11/9/12
to django...@googlegroups.com
Quick note: when using virutalenv on Windows, one runs the activate script to use the environment.  <env name>\Scripts\activate.bat

Same function as the source command in Linux.

Dan Gentry


Francesco Serafini

unread,
Nov 9, 2012, 10:07:52 AM11/9/12
to django...@googlegroups.com
I am sure I activated the environment but nothing. In my case I guess I had some problem with the PATH variable..


2012/11/9 Dan Gentry <d...@gentryville.net>
Quick note: when using virutalenv on Windows, one runs the activate script to use the environment.  <env name>\Scripts\activate.bat

Same function as the source command in Linux.

Dan Gentry


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Msx_DI0lDi8J.
Reply all
Reply to author
Forward
0 new messages