2011-05-03 69 views
0

任何人都可以幫助我在Django擺脫這些警告嗎?Django模塊已經導入和python雞蛋警告

/usr/lib/python2.6/site-packages/simplejson-2.1.5-py2.6-linux-x86_64.egg/simplejson/_speedups.py:3: UserWarning: Module taggit was already imported from /var/www/html/matilah/taggit/__init__.py, but /usr/lib/python2.6/site-packages/django_taggit-0.9.3-py2.6.egg is being added to sys.path 

Traceback (most recent call last): 
File "manage.py", line 11, in <module> 
    execute_manager(settings) 
File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager 
    utility.execute() 
File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 261, in fetch_command 
    klass = load_command_class(app_name, subcommand) 
File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 67, in load_command_class 
    module = import_module('%s.management.commands.%s' % (app_name, name)) 
File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
File "/usr/lib/python2.6/site-packages/haystack/__init__.py", line 154, in <module> 
    handle_registrations() 
File "/usr/lib/python2.6/site-packages/haystack/__init__.py", line 151, in handle_registrations 
    search_sites_conf = importlib.import_module(settings.HAYSTACK_SITECONF) 
File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
File "/var/www/html/matilah/search_sites.py", line 2, in <module> 
    haystack.autodiscover() 
File "/usr/lib/python2.6/site-packages/haystack/__init__.py", line 106, in autodiscover 
    app_path = importlib.import_module(app).__path__ 
File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
File "/var/www/html/matilah/disqus/__init__.py", line 5, in <module> 
    from django.utils import simplejson as json 
File "/usr/lib/python2.6/site-packages/django/utils/simplejson/__init__.py", line 111, in <module> 
    import simplejson 
File "/usr/lib/python2.6/site-packages/simplejson-2.1.5-py2.6-linux-x86_64.egg/simplejson/__init__.py", line 111, in <module> 

File "/usr/lib/python2.6/site-packages/simplejson-2.1.5-py2.6-linux-x86_64.egg/simplejson/decoder.py", line 7, in <module> 
File "/usr/lib/python2.6/site-packages/simplejson-2.1.5-py2.6-linux-x86_64.egg/simplejson/scanner.py", line 10, in <module> 
File "/usr/lib/python2.6/site-packages/simplejson-2.1.5-py2.6-linux-x86_64.egg/simplejson/scanner.py", line 6, in _import_c_make_scanner 
File "/usr/lib/python2.6/site-packages/simplejson-2.1.5-py2.6-linux-x86_64.egg/simplejson/_speedups.py", line 7, in <module> 
File "/usr/lib/python2.6/site-packages/simplejson-2.1.5-py2.6-linux-x86_64.egg/simplejson/_speedups.py", line 4, in __bootstrap__ 
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 841, in resource_filename 
    self, resource_name 
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1310, in get_resource_filename 
    self._extract_resource(manager, self._eager_to_zip(name)) 
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1332, in _extract_resource 
    self.egg_name, self._parts(zip_path) 
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 921, in get_cache_path 
    self.extraction_error() 
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 887, in extraction_error 
    raise err 
pkg_resources.ExtractionError: Can't extract file(s) to egg cache 

The following error occurred while trying to extract file(s) to the Python egg 
cache: 

[Errno 13] Permission denied: '/home/interworx/.python-eggs' 

The Python egg cache directory is currently set to: 

/home/interworx/.python-eggs 

Perhaps your account does not have write access to this directory? You can 
change the cache directory by setting the PYTHON_EGG_CACHE environment 
variable to point to an accessible directory. 

我不知道如果「模塊已經進口」的錯誤已與「不能提取PYTHON蛋」錯誤的事。

在我的WSGI中,我已經有了以下行os.environ['PYTHON_EGG_CACHE'] = rel('python-eggs'),並且我確實知道這是行得通的。否則,WSGI將不會加載我的應用程序。所以我不確定這裏要做什麼。

謝謝!

回答

2

當您收到類似「您的帳戶可能無法訪問此目錄的寫入權限?最好做一個快速測試。嘗試將其更改爲「/ tmp」(可由所有人寫入)並查看是否開始工作。如果解決了這個問題,您可以確定一個更合適的目錄,並確保您(或服務器)具有寫入權限。

更新:您在選擇解決最早的錯誤消息時是正確的。這是一個快速實用程序,Python Module Dump,我幾年前編寫的,用於追蹤錯誤包含的模塊錯誤。您可以嘗試在初始化代碼路徑中的有趣點處插入它,並查看是否可以在早期導入時發現。

+0

感謝您的回覆。是的,我瞭解權限。我感到困惑的是,我認爲我已將PYTHON_EGG目錄更改爲'os.environ ['PYTHON_EGG_CACHE'] = rel('python-eggs')',這是我在.wsgi文件中完成的。這導致'/ my/project/path/python-egg',我知道它肯定有寫權限。所以我的問題是爲什麼它試圖解壓到'/ home/interworx/.python-eggs'? – rabbid 2011-05-03 09:13:56

+0

對不起。你的第一行很長,錯誤大概是3個屏幕寬度向右滾動。 – 2011-05-03 14:53:47

+0

是的,我知道。我的錯 ! :) 有任何想法嗎? – rabbid 2011-05-03 15:10:44

0

您的初始問題「模塊已經導入」實際上與您遇到的權限錯誤有關。您最好的選擇是修復/home/interworx/.python-eggs目錄上的權限/所有權設置(如上面的Peter Rowell所述)。

我今天在谷歌代碼大學遇到了這個很好的小複習。不會傷害通過這個脫脂當你有一段時間了:http://code.google.com/edu/tools101/linux/ownership_permissions.html

剛纔看了上面這裏的評論是我的想法:

我認爲問題是,.wsgi文件沒有設置環境變量時間。你可以請張貼你的.wsgi文件嗎?另外,你如何抓包?它是一個腳本?通過點子手動?

+0

感謝您的回覆!請參閱我對彼得關於權限的回答的評論。謝謝! – rabbid 2011-05-03 09:15:10