开发者

django manage.py syncdb not working?

Trying to learn Django, I closed the shell and am getting this problem now when I call python manage.py syncdb, any idea what happened?:

I开发者_StackOverflow社区've already set up a db. I have manage.py set up in the folder django_bookmarks. What's up here?

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
my-computer:~/Django-1.1.1/django_bookmarks mycomp$ export PATH=/Users/mycomp/bin:$PATH
my-computer:~/Django-1.1.1/django_bookmarks mycomp$ python manage.py syncdb
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
my-computer:~/Django-1.1.1/django_bookmarks mycomp$ 


Looks like Django is not available in any of the directories in your PYTHONPATH.

Check to see if django is available from the command prompt:

$ python -c 'import django'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named django
$ # crash and burn...

Assuming you get that error, add the path to django to PYTHONPATH.

$ export PYTHONPATH=/path/to/django:$PYTHONPATH
$ python -c 'import django'
$ # hurray!

If you extracted Django-1.1.1.tgz into ~/Django-1.1.1 use "~/Django-1.1.1" not "~/Django-1.1.1/django" for the /path/to/django.


Did you remember to activate your VirtualEnv? That was my problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜