使用chargebee集成在dotcloud上推动我的django应用程序时出错

时间:2014-01-22 15:38:01

标签: python django python-2.7 django-models

我正在我的django app上推出与chargebee集成的dotcloud。我收到以下错误:

Traceback (most recent call last):
15:26:36.355239: [www.0]   File "createdb.py", line 7, in <module>
15:26:36.356211: [www.0]     from wsgi import *
15:26:36.356725: [www.0]   File "/home/dotcloud/rsync-1390404227083/wsgi.py", line 4, in <module>
15:26:36.357324: [www.0]     from hellodjango.wsgi import application
15:26:36.357819: [www.0]   File "/home/dotcloud/rsync-1390404227083/hellodjango/hellodjango/wsgi.py", line 6, in <module>
15:26:36.358456: [www.0]     import django.core.handlers.wsgi
15:26:36.358990: [www.0]   File "/opt/ve/2.6/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 11, in <module>
15:26:36.359733: [www.0]     from django.core.handlers import base
15:26:36.360280: [www.0]   File "/opt/ve/2.6/lib/python2.6/site-packages/django/core/handlers/base.py", line 12, in <module>
15:26:36.360963: [www.0]     from django.db import connections, transaction
15:26:36.361626: [www.0]   File "/opt/ve/2.6/lib/python2.6/site-packages/django/db/__init__.py", line 83, in <module>
15:26:36.362305: [www.0]     signals.request_started.connect(reset_queries)
15:26:36.362845: [www.0]   File "/opt/ve/2.6/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 88, in connect
15:26:36.363499: [www.0]     if settings.DEBUG:
15:26:36.364079: [www.0]   File "/opt/ve/2.6/lib/python2.6/site-packages/django/conf/__init__.py", line 54, in __getattr__
15:26:36.364739: [www.0]     self._setup(name)
15:26:36.365279: [www.0]   File "/opt/ve/2.6/lib/python2.6/site-packages/django/conf/__init__.py", line 49, in _setup
15:26:36.365926: [www.0]     self._wrapped = Settings(settings_module)
15:26:36.366452: [www.0]   File "/opt/ve/2.6/lib/python2.6/site-packages/django/conf/__init__.py", line 132, in __init__
15:26:36.367101: [www.0]     % (self.SETTINGS_MODULE, e)
15:26:36.367908: [www.0] ImportError: Could not import settings 'hellodjango.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named chargebee

1 个答案:

答案 0 :(得分:0)

登录您的django shell并检查环境变量是否指向您的应用 设置。

python manage.py shell

在django console

中运行这些命令
In [1]: import os

In [2]: os.environ["DJANGO_SETTINGS_MODULE"]

您应该看到如下输出:

  

&LT; appname中&GT; .settings

在你的情况下它应该是 hellodjango.settings

如果不同,请在manage.py文件中设置。

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<appname>.settings")

当我通过/usr/local/lib/python2.7/dist-packages [不在site_packages下]的pip安装ChargeBee时,这对我有用

检查ChargeBee的安装位置,并查看sys.path中是否存在该路径。如果不做sys.path.append("chargebee_installation_path")则应该这样做。