Django开发者群  - 讨论区

标题:请教使用django-tagging的问

2010年08月30日 星期一 09:56

1.正常安装、正常导入、正常在模型中使用。

 

2.在python manage.py syncdb时没有对tagging_tag表的描述。

 

3.提示异常信息为:

OperationalError at /admin/coltrane/entry/add/

 no such table: tagging_tag
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/coltrane/entry/add/
Exception Type: OperationalError
Exception Value:
     no such table: tagging_tag
    

2010年08月30日 星期一 10:06

>>> import tagging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python26\lib\site-packages\tagging\__init__.py", line 3, in <module>
    from tagging.managers import ModelTaggedItemManager, TagDescriptor
  File "D:\Python26\lib\site-packages\tagging\managers.py", line 5, in <module>
    from django.contrib.contenttypes.models import ContentType
  File "D:\Python26\lib\site-packages\django\contrib\contenttypes\models.py", li
ne 1, in <module>
    from django.db import models
  File "D:\Python26\lib\site-packages\django\db\__init__.py", line 9, in <module
>
    if not settings.DATABASE_ENGINE:
  File "D:\Python26\lib\site-packages\django\utils\functional.py", line 269, in
__getattr__
    self._setup()
  File "D:\Python26\lib\site-packages\django\conf\__init__.py", line 37, in _set
up
    raise ImportError("Settings cannot be imported, because environment variable
 %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SE
TTINGS_MODULE is undefined.

 

2010年08月30日 星期一 10:06

http://docs.djangoproject.com/en/dev/ref/templates/api/#configuring-the-template-system-in-standalone-mode

http://hi.baidu.com/withjourney/blog/item/22f072508ca755020cf3e3ff.html

做个记号,再研究。崩溃中……

把tag有关的行注释掉了,然后下载了个sqliteadmin把数据库表里的tags也删除了。

 

2010年08月30日 星期一 11:15

问题解决了:tagging作为一个app,要想应用,需要在INSTALLED_APPSS中加上。

仔细看了一下:http://hi.baidu.com/10428/blog/item/8a9eb50e5b84e5e337d1226a.html

 Using Django Tagging in your applications
 
-----------------------------------------

Once you've installed Django Tagging and want to use it in your Django
applications, do the following:

1. Put ``'tagging'`` in your ``INSTALLED_APPS`` setting.
2. Run the command ``manage.py syncdb``.

The ``syncdb`` command creates the necessary database tables and
creates permission objects for all installed apps that need them.

That's it!

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号