2013-10-06 26 views
0

我下載並安裝了django-wsgiserver應用程序,所以我可以用我的django項目cherrypy。我用pip來安裝它,並將它添加到我的settings.py中。我在我的manage.py上看到了runwsgiserver命令。但是當我嘗試運行它時,出現以下錯誤django-wsgiserver爲cherrypy和django

./manage.py runwsgiserver 
KeyError: 'default' 

可能是什麼故障?你需要更多的信息嗎?

setting.py 

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'django_wsgiserver', 
    'south', 
    # Uncomment the next line to enable the admin: 
    'django.contrib.admin', 
    # Uncomment the next line to enable admin documentation: 
    # 'django.contrib.admindocs', 
) 

編輯:現在P..But我得到這個消息

./manage.py runwsgiserver host=0.0.0.0 staticserve=False 
Validating models.. 
0 errors found 
October 06, 2013 - 11:02:37 
Django version 1.5.4, using settings 'rhombus.settings' 
cherrypy django_wsgiserver is running at http://0.0.0.0:8000/ 
Quit the server with CONTROL-C. 
Unhandled exception in thread started by <bound method Command.start_server_servestatic  of <django_wsgiserver.management.commands.runwsgiserver.Command object at 0x9f6c70c>> 
Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/django_wsgiserver/management/commands/runwsgiserver.py", line 469, in start_server_servestatic 
    server.start() 
    File "/usr/local/lib/python2.7/dist-packages/django_wsgiserver/wsgiserver/wsgiserver2.py", line 1857, in start 
    raise socket.error(msg) 
socket.error: No socket could be created 

爲什麼是這樣的:我解決它......不得不添加數據庫引擎?

+0

我找到了解決辦法....我沒有數據庫引擎設置... – Apostolos

回答

0

是的,如果您遇到問題,請在運行./manage.py runwsgiserver之前確保其他工具在您的django項目中正常工作。例如,做::

./manage.py執行syncdb ./manage.py的runserver#來測試項目與內置的服務器

你看到的,如果另一個可能出現的特定套接字錯誤進程正在運行已經使用的端口8000.

另外,我可以看到你使用的是django 1.5.4。它總是有助於提及其他應用程序的版本以及您正在運行的操作系統:linux?,mac?,windows? django-wsgiserver 0.8.0rc?

我希望現在一切都爲你工作。

-CLM

+0

謝謝回答。畢竟,我沒有使用django-wsgiserver。我只想要靜態服務的方式。所以我創建了一個像他描述的應用程序,並將它轉移到我在另一個python腳本上創建的cherrypy wsgiserver實例上。我也嘗試過這個模塊,它的工作原理可能是runserver仍然佔用我的端口 – Apostolos