django manage.pysyncdb 不工作?

发布于 2024-08-30 16:13:58 字数 760 浏览 6 评论 0原文

尝试学习 Django,我关闭了 shell,现在当我调用 python manage.pysyncdb 时遇到这个问题,知道发生了什么吗?:

我已经设置了一个数据库。我在django_bookmarks文件夹中设置了manage.py。这是怎么回事?

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$ 

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'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$ 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天涯沦落人 2024-09-06 16:13:58

看起来 Django 在 PYTHONPATH 中的任何目录中都不可用。

从命令提示符检查 django 是否可用:

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

假设您收到该错误,请将 django 的路径添加到 PYTHONPATH。

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

如果您将 Django-1.1.1.tgz 提取到 ~/Django-1.1.1 中,请使用“~/Django-1.1.1”而不是“~/Django-1.1.1/django”作为 /path/to/django。

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.

浊酒尽余欢 2024-09-06 16:13:58

您记得激活 VirtualEnv 吗?那是我的问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文