2014-03-07 30 views
0

我不知道如何可能,但我的模塊找不到。我想整合haystack到django應用程序。當我將它推送到openshift時,我在setup.py中指定了'django_haystack',但它不起作用。所以我從python dist複製haystack包到我的django項目。在django應用程序中openshift上找不到模塊

. 
├── controller 
├── database 
├── django_crontab 
├── faq 
├── haystack 
├── lib 
├── registration 
├── stocks 
└── whoosh 

我在settings.py中將'haystack'添加到installed_apps。爲了確保這個包在我的本地主機上有效,我通過pip卸載了python dist-packages中的django_haystack。在本地主機上它工作。我試圖將haystack.forms導入stocks.forms。 我推送新的承諾openshift。我嘗試加載我的網站時遇到錯誤代碼500。錯誤是:

[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] ImportError: No module named forms 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] mod_wsgi (pid=262837): Exception occurred processing WSGI script '/var/lib/openshift/526ed6ba4382eca6ff000024/app-root/runtime/repo/wsgi/application'. 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] Traceback (most recent call last): 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] File "/var/lib/openshift/526ed6ba4382eca6ff000024/python/virtenv/lib/python2.7/site-packages/Django-1.5.5-py2.7.egg/django/core/handlers/wsgi.py", line 255, in __call__ 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129]  response = self.get_response(request) 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] File "/var/lib/openshift/526ed6ba43826ff000024/python/virtenv/lib/python2.7/site-packages/Django-1.5.5-py2.7.egg/django/core/handlers/base.py", line 178, in get_response 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129]  response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] File "/var/lib/openshift/526ed6ba43826ff000024/python/virtenv/lib/python2.7/site-packages/Django-1.5.5-py2.7.egg/django/core/handlers/base.py", line 220, in handle_uncaught_exception 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129]  if resolver.urlconf_module is None: 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] File "/var/lib/openshift/526ed6ba43826ff000024/python/virtenv/lib/python2.7/site-packages/Django-1.5.5-py2.7.egg/django/core/urlresolvers.py", line 342, in urlconf_module 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129]  self._urlconf_module = import_module(self.urlconf_name) 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] File "/var/lib/openshift/526ed6ba43826ff000024/python/virtenv/lib/python2.7/site-packages/Django-1.5.5-py2.7.egg/django/utils/importlib.py", line 35, in import_module 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129]  __import__(name) 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] File "/var/lib/openshift/526ed6ba43826ff000024/app-root/runtime/repo/wsgi/digrin/controller/urls.py", line 3, in <module> 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129]  from stocks.forms import AdvancedSearchForm, AutocompleteModelSearchForm 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] File "/var/lib/openshift/526ed6ba43826ff000024/app-root/runtime/repo/wsgi/digrin/stocks/forms.py", line 31, in <module> 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129]  from haystack.forms import ModelSearchForm 
[Mon Mar 24 16:10:35 2014] [error] [client 127.3.111.129] ImportError: No module named forms 

ImportError: No module named forms 

所以它基本上是第一次提到haystack應用程序。我用ssh登錄到了我的openshift帳戶,然後運行./manage.py shell,我嘗試了from haystack.forms import ModelSearchForm。它沒有問題地加載。

我在這裏沒有想法,我也嘗試過./manage.py syncdb./manage.py migrate以防萬一haystack錯過了一些數據庫表。也嘗試重新啓動應用程序。沒有幫助。我錯過了什麼?

######################### EDIT1

好了,我從我的應用程序刪除的文件夾草垛,並添加django_haystack到的setup.py爲指示。

我看了是什麼文件,在文件夾草垛我的本地服務器:

[email protected]:~$ ls /usr/local/lib/python2.7/dist-packages/haystack 
admin.py  constants.pyc fields.pyc indexes.pyc inputs.pyc models.py query.py  signals.py urls.py views.pyc 
admin.pyc  exceptions.py forms.py __init__.py management models.pyc query.pyc signals.pyc urls.pyc 
backends  exceptions.pyc forms.pyc __init__.pyc manager.py panels.py routers.py templates  utils 
constants.py fields.py  indexes.py inputs.py  manager.pyc panels.pyc routers.pyc templatetags views.py 

而這其中manage.py點我草垛。

>>> import haystack 
>>> haystack 
<module 'haystack' from '/var/lib/openshift/526ed6ba43826ff000024/python/virtenv/lib/python2.7/site-packages/haystack-0.16-py2.7.egg/haystack/__init__.pyc'> 
>>> 

,這是我openshift草垛內容:

ls /var/lib/openshift/526ed6ba43826ff000024/python/virtenv/lib/python2.7/site-packages/haystack-0.16-py2.7.egg/haystack/ 
abouchet.py  basicmodel.pyc dump_loader.py listmodel.py  memory_dumper.pyc model.py win-dump-heap.py 
abouchet.pyc  config.py  dump_loader.pyc listmodel.pyc  memory_mapper.py model.pyc win-dump-heap.pyc 
argparse_utils.py config.pyc  gui   __main__.py  memory_mapper.pyc reverse 
argparse_utils.pyc dbg.py  __init__.py  __main__.pyc  memory_mapping.py utils.py 
basicmodel.py  dbg.pyc  __init__.pyc  memory_dumper.py memory_mapping.pyc utils.pyc 

這是我的地盤包: 站點包]> LS

argparse-1.2.1-py2.7.egg  easy-install.pth  pip    setuptools 
Digrin.egg-link   easy_install.py  pip-1.4-py2.7.egg-info setuptools-0.9.8-py2.7.egg-info 
Django-1.5.5-py2.7.egg   easy_install.pyc  pkg_resources.py   six-1.4.1-py2.7.egg 
django_extensions-1.2.5-py2.7.egg haystack-0.16-py2.7.egg pkg_resources.pyc  South-0.8.2-py2.7.egg 
django_haystack-2.1.0-py2.7.egg _markerlib   python_ptrace-0.7-py2.7.egg 

回答

0

我加django_haystack版本的setup.py ,刪除網站包中的乾草堆-0.16-py2.7.egg文件夾,它的工作原理。不知道我在那裏得到了舊版本。

相關問題