2012-06-14 169 views
0

我正在嘗試部署正在開發的django應用程序。我已經更新它與django 1.3一起工作,並且一切都以調試模式工作。只要我將設置中的DEBUG切換爲False,服務器就會返回下面的錯誤。當debug = false時,Django + Apache + mod_wsgi失敗

Internal Server Error 
The server encountered an internal error or misconfiguration and was unable to complete your request. 
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error. 
More information about this error may be available in the server error log. 
Apache/2.2.14 (Ubuntu) Server at 192.168.1.220 Port 80 

我個人不想使用apache,但它被堅持在我身上。 任何人都可以指向我可能是什麼?

Traceback (most recent call last): 

File "/home/fakeco/django1.3/django/core/handlers/base.py", line 89, in get_response 
    response = middleware_method(request) 

File "/home/fakeco/django1.3/django/middleware/common.py", line 67, in process_request 
    if (not _is_valid_path(request.path_info, urlconf) and 

File "/home/fakeco/django1.3/django/middleware/common.py", line 154, in _is_valid_path 
    urlresolvers.resolve(path, urlconf) 

File "/home/fakeco/django1.3/django/core/urlresolvers.py", line 342, in resolve 
    return get_resolver(urlconf).resolve(path) 

File "/home/fakeco/django1.3/django/core/urlresolvers.py", line 250, in resolve 
    for pattern in self.url_patterns: 

File "/home/fakeco/django1.3/django/core/urlresolvers.py", line 279, in _get_url_patterns 
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) 

File "/home/fakeco/django1.3/django/core/urlresolvers.py", line 274, in _get_urlconf_module 
    self._urlconf_module = import_module(self.urlconf_name) 

File "/home/fakeco/django1.3/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 

File "/home/fakeco/domains/fakeco-directory.co.uk/fakecodirectory/urls.py", line 3, in <module> 
    admin.autodiscover() 

File "/home/fakeco/django1.3/django/contrib/admin/__init__.py", line 26, in autodiscover 
    import_module('%s.admin' % app) 

File "/home/fakeco/django1.3/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 

File "/home/fakeco/domains/fakeco-directory.co.uk/fakecodirectory/contacts/admin.py", line 2, in <module> 
    import fakecodirectory.contacts.models as models 

File "/home/fakeco/domains/fakeco-directory.co.uk/fakecodirectory/contacts/models.py", line 3, in <module> 
    from fakecodirectory.generic.models import Country, Title 

File "/home/fakeco/domains/fakeco-directory.co.uk/fakecodirectory/generic/models.py", line 9, in <module> 
    from fakecodirectory.contacts.models import Manufacturer 

ImportError: cannot import name Manufacturer 

回答

3

請確保您有:

  1. 創建一個500.html template
  2. 將自己的電子郵件地址到 ADMINS 設置,以便通過電子郵件發送的回溯。
  3. 看看Apache的錯誤日誌,看看有沒有什麼有用的信息。對於Ubuntu的,看在/var/log/apache2/
+0

我做了500.html模板,但感謝的電子郵件設置尖,不知道我怎麼測試,如果盒子可以發送電子郵件雖然 – Jharwood

+0

我現在有錯誤:導入錯誤:不能導入名稱制造商 – Jharwood

+1

它看起來像一個循環導入。您的'generic'應用程序正在從'contacts'應用程序導入,反之亦然。如果您正在導入以創建外鍵,則將該模型稱爲字符串並刪除導入。請參閱[外鍵文檔](https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey)瞭解更多信息。 – Alasdair