谁能帮我。我刚刚使用easy_install安装了django-tables2,当我尝试import django_tables2 as tables
在forms.py中它给我错误unresolved import: tables
然后我尝试再次重新安装django_tables2并给我如下所示的结果。
$ easy_install django_tables2
Searching for django-tables2
Best match: django-tables2 0.13.0
Processing django_tables2-0.13.0-py2.7.egg
django-tables2 0.13.0 is already the active version in easy-install.pth
Using c:\python27\lib\site-packages\django_tables2-0.13.0-py2.7.egg
Processing dependencies for django-tables2
Finished processing dependencies for django-tables2
非常感谢您的帮助。
更新的问题。
我仍在努力解决这个问题。我发布了一个关于为什么我无法导入的新错误。通过使用python manage.py shell
我得到这个错误。我不知道那是什么意思。
$ python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django_tables2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win32\egg\django_tables2\__init__.py", line 3, in <module>
File "build\bdist.win32\egg\django_tables2\tables.py", line 4, in <module>
File "c:\Python27\lib\site-packages\django\db\__init__.py", line 11, in <module>
if DEFAULT_DB_ALIAS not in settings.DATABASES:
File "c:\Python27\lib\site-packages\django\utils\functional.py", line 184, in inner
self._setup()
File "c:\Python27\lib\site-packages\django\conf\__init__.py", line 40, in _setup
raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
任何人都可以帮助我吗?:(非常感谢您的帮助。谢谢。