在安装django-tracking时遇到错误

时间:2013-09-21 08:38:09

标签: python django

我正在尝试安装django-tracker并将其解压缩到一个目录中,现在当我运行python setup.py时,我收到了followig错误

     vikas@vikas-laptop:~/djcode/django-tracking-0.4.1$ python setup.py
     Traceback (most recent call last):
     File "setup.py", line 6, in <module>
     import tracking
     File "/home/vikas/djcode/django-tracking-0.4.1/tracking/__init__.py", line 1, in      <module>
    import listeners
     File "/home/vikas/djcode/django-tracking-0.4.1/tracking/listeners.py", line 6, in       <module>
     from django.core.cache import cache
     File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 70, in    <module>
     if DEFAULT_CACHE_ALIAS not in settings.CACHES:
    File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
 File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
 django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings    are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

有人可以帮我解决这个问题吗?

3 个答案:

答案 0 :(得分:3)

尝试以下替代方法:

<强> pip install git+https://github.com/bashu/django-tracking.git

这对我有用。以下是相同的痕迹:

root@3239fee56ba9:/home/docker/code/gstudio/gnowsys-ndf# pip install git+https://github.com/bashu/django-tracking.git
Collecting git+https://github.com/bashu/django-tracking.git
  Cloning https://github.com/bashu/django-tracking.git to /tmp/pip-IMNBJq-build
Requirement already satisfied (use --upgrade to upgrade): django>=1.4 in /usr/local/lib/python2.7/dist-packages (from django-tracking==0.4.1)
Installing collected packages: django-tracking
  Running setup.py install for django-tracking ... done
Successfully installed django-tracking-0.4.1

答案 1 :(得分:1)

django-tracking需要一些修复才能使用Django 1.5和1.6。

我在这里创建了一个分叉https://github.com/pcraston/django-tracking

(修复了Django 1.5是从https://bitbucket.org/romanalexander/django-tracking复制的)

答案 2 :(得分:0)

你应该给python setup.py一个特定的命令。如果您想安装它,请执行以下操作:

$ python setup.py install

如果您希望使用该软件包进行增强,请执行以下操作:

$ python setup.py develop

当然,不言而喻,这应该发生在virtualenv内,如果您要安装软件包,可以通过pip进行。