我可以使用 MySQLdb 连接到数据库,但无法使用 django 连接请任何人帮助我
所有参数都是正确的,如主机、密码和用户名。
当我尝试导入有关 django 的 python 解释器时,我收到以下错误
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py", line 14, in <module>
if not settings.DATABASES:
File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/usr/local/lib/python2.6/dist-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.
当然我已经安装了 django。
请帮帮我,我是 django 的新手....