2013-02-10 72 views
6

私のアプリケーションは昨夜働いていましたが、なぜ今朝は動作しないのかわかりません。私がしたことは、モデル、テスト、およびビューを保存するためのdjangoというアプリを作成することだったと思います。djangoエラー:間違った設定:WSGIアプリケーション

、このエラーを取得OS X上でHerokuのPostgresのアプリケーションとジャンゴを実行し、ミドルウェアとしてdj_database:

File "/Users/{ME}/Projects/{PROJECT}/{PROJECT}/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 58, in get_internal_wsgi_application 
    "could not import module '%s': %s" % (app_path, module_name, e)) django.core.exceptions.ImproperlyConfigured: WSGI application 
'{PROJECT}.wsgi.application' could not be loaded; could not import module 
'{PROJECT}.wsgi': No module named core.wsgi 

wsgi.pyファイルの関連部分:

""" 
WSGI config for {PROJECT} project. 

This module contains the WSGI application used by Django's development 
server and any production WSGI deployments. It should expose a 
module-level variable named ``application``. Django's ``runserver`` 
and ``runfcgi`` commands discover this application via the 
``WSGI_APPLICATION`` setting. 

Usually you will have the standard Django WSGI application here, but 
it also might make sense to replace the whole Django WSGI application 
with a custom one that later delegates to the Django one. For example, 
you could introduce WSGI middleware here, or combine a Django 
application with an application of another framework. 

""" 
import os 

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "do.settings") 

# This application object is used by any WSGI server configured to use this 
# file. This includes Django's development server, if the WSGI_APPLICATION 
# setting points here. 
from django.core.wsgi import get_wsgi_application 
application = get_wsgi_application() 

# Apply WSGI middleware here. 
# from helloworld.wsgi import HelloWorldApplication 
# application = HelloWorldApplication(application) 

関連(と思う)の部分私のsettings.pyファイル:

WSGI_APPLICATION = '{PROJECT}.wsgi.application' 

# ... 

import dj_database_url 
DATABASES['default'] = dj_database_url.config(default='sqlite://db/sqlite3.db') 

答えて

7

djangoというアプリは、from django import Xがあなたのアプリを見ていることを意味し、djangoフレームワークではありません。

この場合、ソフトウェアはdjango.core.wsgiをインポートしようとしていますが、アプリのコードでこのファイルを探していますが、どこにも見つかりません。したがって、エラー:No module named core.wsgi


アプリ別の名前を付けます。

あなたのアプリを含むフォルダの名前を変更する必要があります。INSTALLED_APPSのエントリはsettings.pyになります。

+0

それをやりました!ありがとう! – fox

+0

@foxお手伝いを!別のPythonのモジュールをあなたのもので上書きしないように注意してください。) –

+0

はい、意味があります。もう1つの質問です。アプリは決して 'INSTALLED_APPS'の下には載っていませんでした。私が忘れているのは、アプリケーションのディレクトリが私の現在のプロジェクトディレクトリ(つまり、 'project \ app')内にあれば、djangoがそれを拾うためにそこにリストアップする必要がありますか? – fox

0

ジャンゴdocumentationから:

You’ll need to avoid naming projects after built-in Python or Django components. In particular, this means you should avoid using names like django (which will conflict with Django itself) or test (which conflicts with a built-in Python package).

関連する問題