我想使用 django-syncr 在我的主页上放一个 flickr 提要;我按照主页上的说明(http://code.google.com/p/django-syncr/),安装过程非常顺利。步骤 1-3 工作得很好,但步骤 4 是我遇到问题的地方。
当我尝试运行显示的命令时:
from syncr.app.flickr import FlickrSyncr
我得到错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/django_syncr-0.50-py2.7.egg/sync/app/flickr.py", line 11, in <module>
from syncr.flickr.models import *
File "/usr/local/lib/python2.7/dist-packages/django_syncr-0.50-py2.7.egg/syncr/flickr/models.py", line 1, in <module>
from django.db import models
File "/usr/lib/python2.7/dist-packages/django/db/__init__.py", line 14, in <module>
if not settings.DATABASES:
File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 276, in __getattr__self._setup()
File "/usr/lib/python2.7/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 项目文件夹中运行,但包括设置文件(通过导入设置)似乎无法解决此问题。为了导入正确的变量,应该包含哪些文件?
谢谢!