ImportError: No module named django.core.management

1,303 views
Skip to first unread message

tampler_knight

unread,
Jul 13, 2008, 1:26:26 PM7/13/08
to Django users
Hi all,

I installed the 'Django poll application' that comes with the Django
tutorial.

When I try to start the webserver using the command

C:\django-poll\mysite>python manage.py runserver

I get the following error:

Traceback (most recent call last):
File "manage.py", line 2, in <module>
from django.core.management import execute_manager
ImportError: No module named django.core.management

Would really appreciate if someone please advised me as to what am I
doing wrong.

BTW, I am using Windows XP SP2 and have Python 2.5 installed on my
machine.

Thanks in advance.
templar_knight

Karen Tracey

unread,
Jul 13, 2008, 2:27:57 PM7/13/08
to django...@googlegroups.com
Python isn't finding Django in your PYTHONPATH.  You do not say what version of Django you installed or where you put it.  Apparently you did not use the setup.py procedure which puts django in your Python site-packages directory so that it is automatically found by Python.  That is fine, but if you choose not to install django in site-packages then you need to set your PYTHONPATH environment variable to point to django so that python can find it.  See:

http://www.djangoproject.com/documentation/install/#install-the-django-code

Karen

tampler_knight

unread,
Jul 14, 2008, 12:40:00 AM7/14/08
to Django users
Thank you so much for the reply, Karen. Greatly appreciated.

I am using Django-0.96.2 which is installed in the C drive of my
machine (running Windows XP SP2).

As advised in the documentation, I tried to use 'setup.py install' but
I get the following error:

C:\Django-0.96.2>setup.py install
running install
running build
running build_py
error: package directory '\django' does not exist

Can you please advise me how I can get rid of this error.

Thanks in advance.
templar_knight
> http://www.djangoproject.com/documentation/install/#install-the-djang...
>
> Karen

Karen Tracey

unread,
Jul 14, 2008, 12:54:02 AM7/14/08
to django...@googlegroups.com
On Mon, Jul 14, 2008 at 12:40 AM, tampler_knight <ros...@gmail.com> wrote:

Thank you so much for the reply, Karen. Greatly appreciated.

I am using Django-0.96.2 which is installed in the C drive of my
machine (running Windows XP SP2).

As advised in the documentation, I tried to use 'setup.py install' but
I get the following error:

C:\Django-0.96.2>setup.py install
running install
running build
running build_py
error: package directory '\django' does not exist

Can you please advise me how I can get rid of this error.

Honestly I'd recommend upgrading to an SVN checkout of django.  That error, along with other Windows-specific problems with setup.py have been fixed in the current code.  Plus you get over a years worth of bug fixes and significant improvements (unicode, autoescape, queryset improvements).  Unless you have pre-existing code that you don't want to adjust for backwards-incompatible changes since 0.96, I see no reason to stick with an 0.96.x release.

If you really need to use an 0.96 release, pull just the current setup.py from SVN. You can download it from here: http://code.djangoproject.com/browser/django/trunk/setup.py (there are download links at the bottom of the page) and use it instead of the one that comes with 0.96.

Karen

templar_knight

unread,
Jul 15, 2008, 11:48:14 PM7/15/08
to Django users
Thanks for the reply Karen.

I think I'll upgrade to an SVN checkout of Django, as you advised.

Thanks a lot for your advice.

:-)
> from SVN. You can download it from here:http://code.djangoproject.com/browser/django/trunk/setup.py(there are

Kadusale, Myles

unread,
Jul 16, 2008, 1:39:54 AM7/16/08
to django...@googlegroups.com
Help!

I am trying out Django but I get this error in my console

C:\DjangoProj\UserApp>python manage.py syncdb
Error: Couldn't install apps, because there were errors in one or more
models:
UserApp.UserProfile: invalid syntax (models.py, line 12)


------------------------------------------------------------------------
---
C:\DjangoProj\UserApp\UserProfile\models.py
------------------------------------------------------------------------
----

1. from django.db import models
2. from django.contrib.auth.models import User
3.
4. GENDER_CHOICES = (
5. ('M', 'Male'),
6. ('F', 'Female'),
7. )
8.
9. # Create your models here.
10. class UserProfile(models.Model):
11. user_id = models.CharField('User ID', max_length=5,
primary_key=True)
12. user_fname = models.CharField('First Name', max_length=30)
user_lname = models.CharField('Last Name', max_length=50)
user_email = models.EmailField('Email Address', blank=True)
user_gndr = models.CharField(max_length=1,
choices=GENDER_CHOICES)
user_headshot = models.ImageField(upload_to='img', blank=True,
null=True)
user_bday = models.DateField('Birthday')
user_uname = models.ForeignKey(User, unique=True)


def __str__(self):
return self.user_id

------------------------------------------------------------------------
---


Thanks Myles

Kenneth Gonsalves

unread,
Jul 16, 2008, 3:15:36 AM7/16/08
to django...@googlegroups.com

On 16-Jul-08, at 11:09 AM, Kadusale, Myles wrote:

> 12. user_fname = models.CharField('First Name', max_length=30)
> user_lname = models.CharField('Last Name', max_length=50)
> user_email = models.EmailField('Email Address', blank=True)
> user_gndr = models.CharField(max_length=1,
> choices=GENDER_CHOICES)
> user_headshot = models.ImageField(upload_to='img', blank=True,
>
> null=True)
> user_bday = models.DateField('Birthday')
> user_uname = models.ForeignKey(User, unique=True)

looks like an indentation error

--

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/

Oscar Carlsson

unread,
Jul 16, 2008, 3:12:37 AM7/16/08
to django...@googlegroups.com
Please post the code at dpaste.com, and paste the URL in the mail :-)

As Kenneth suggested, I think it looks like an indentation error, but it's hard to detect or confirm while the mail is displayed with a non-monospaced font.

Oscar

Kadusale, Myles

unread,
Jul 16, 2008, 3:19:00 AM7/16/08
to django...@googlegroups.com
Help!

The indentions of my code in my editor are ok
I hope the code will not be distorted here again

I am trying out Django but I get this error in my console

C:\DjangoProj\UserApp>python manage.py syncdb
Error: Couldn't install apps, because there were errors in one or more
models:
UserApp.UserProfile: invalid syntax (models.py, line 12)


------------------------------------------------------------------------


C:\DjangoProj\UserApp\UserProfile\models.py
------------------------------------------------------------------------

1. from django.db import models


2. from django.contrib.auth.models import User 3.
4. GENDER_CHOICES = (
5. ('M', 'Male'),
6. ('F', 'Female'),
7. )
8.
9. # Create your models here.
10. class UserProfile(models.Model):
11. user_id = models.CharField('User ID',
max_length=5,primary_key=True)
12. user_fname = models.CharField('First Name', max_length=30)
user_lname = models.CharField('Last Name', max_length=50)
user_email = models.EmailField('Email Address', blank=True)
user_gndr = models.CharField(max_length=1,choices=GENDER_CHOICES)
user_headshot = models.ImageField(upload_to='img',
blank=True,null=True)
user_bday = models.DateField('Birthday')
user_uname = models.ForeignKey(User, unique=True)


def __str__(self):
return self.user_id

------------------------------------------------------------------------


Thanks Myles

Kadusale, Myles

unread,
Jul 16, 2008, 3:27:24 AM7/16/08
to django...@googlegroups.com

Help!

The indentions of my code in my editor are ok
I hope the code will not be distorted here again

I am trying out Django but I get this error in my console

C:\DjangoProj\UserApp>python manage.py syncdb
Error: Couldn't install apps, because there were errors in one or more
models:
UserApp.UserProfile: invalid syntax (models.py, line 12)


------------------------------------------------------------------------
C:\DjangoProj\UserApp\UserProfile\models.py

Here is the link of my code

http://dpaste.com/65298/

------------------------------------------------------------------------

Thanks Myles

Kadusale, Myles

unread,
Jul 16, 2008, 4:18:17 AM7/16/08
to django...@googlegroups.com
I just removed the underscore in max_length
And it worked fine maybe because of my Django version

Thanks anyway
Reply all
Reply to author
Forward
0 new messages