Ứng dụng của tôi đã hoạt động tối qua, không chắc chắn tại sao nó không hoạt động sáng nay. Tôi nghĩ rằng tất cả những gì tôi làm là tạo một ứng dụng gọi là django
để lưu trữ các mô hình, kiểm tra và chế độ xem của tôi.lỗi django: Không đúng cấu hình: Ứng dụng WSGI
Bắt lỗi này, chạy django với các ứng dụng Heroku Postgres trên OS X và dj_database như middleware:
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
phần có liên quan của wsgi.py
tập tin của tôi:
"""
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)
liên quan (tôi nghĩ) phần trong số settings.py
tệp của mình:
WSGI_APPLICATION = '{PROJECT}.wsgi.application'
# ...
import dj_database_url
DATABASES['default'] = dj_database_url.config(default='sqlite://db/sqlite3.db')
mà làm được rồi! cảm ơn! – fox
@fox Chúc mừng bạn! Hãy nhớ đảm bảo không bao giờ ghi đè mô-đun khác của Python với mô-đun của bạn:) –
Có, có ý nghĩa. Một câu hỏi bổ sung - ứng dụng không bao giờ được liệt kê trong 'INSTALLED_APPS'. Tôi quên, tôi có phải liệt kê nó ở đó cho django để nhặt nó lên nếu thư mục của ứng dụng nằm trong thư mục dự án hiện tại của tôi (tức là 'project \ app')? – fox