나는이 문제에 대한 여러 가지 질문을 모두 해결했지만 아무도 내 문제를 해결하지 못했습니다. 파이썬 2.7이 설치된 Windows 7 가정용 컴퓨터에서 장고 프로젝트의 최신 버전 django 인 virtualenv로 작업하고 있습니다. 이 프로젝트는 Heroku에있을 예정이지만 로컬로도 작동하지 않습니다.Django "XYZ 레이블이있는 응용 프로그램을 찾을 수 없습니다"
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\__init__.py", line 443, in execute_from_command_line
utility.execute()
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\commands\test.py", line 49, in run_from_argv
super(Command, self).run_from_argv(argv)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\base.py", line 232, in execute
output = self.handle(*args, **options)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\commands\test.py", line 72, in handle
failures = test_runner.run_tests(test_labels)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\test\simple.py", line 380, in run_tests
suite = self.build_suite(test_labels, extra_tests)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\test\simple.py", line 263, in build_suite
app = get_app(label)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\db\models\loading.py", line 152, in get_app
raise ImproperlyConfigured("App with label %s could not be found" % app_labe
l)
django.core.exceptions.ImproperlyConfigured: App with label tryagain could not b
e found
그것도 아주 새로운, 훼손되지 않은 응용 프로그램을 인식하지 못합니다 : manage.py sqlall appname
을 실행하려고 할 때
는 기본적으로 항상 다음과 같은 오류 트리를 반환합니다. 예를 들어, manage.py startapp tryagain
을 실행 한 다음 manage.py test tryagain
과 같은 것을 시도 할 때 여전히 동일한 오류가 발생하므로 'tryagain'
을 INSTALLED_APPS
에 추가하십시오. 내 settings.py
파일이 정상적인 것과 다른 유일한 방법은 Heroku가, 나는 다음 두 줄을 추가 한 것입니다 :
import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
어떤 도움을 크게 감상 할 수있다. 나는 나 자신을 미치게 여기에서 몰고있다.
편집 :
첫째,이 새로운 앱 새로운 장고 프로젝트를 시작했는데, 그것은 여전히 모든 것이 완전히 훼손되지 않은에도 불구하고, 작동하지 않았다.
내가 설정과 관련된 알아낼 수 없기 때문에, 내가 귀찮은 프로젝트에 대한 전체 settings.py
모듈 아래에 제공했습니다
# Django settings for <problem> project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '[email protected]'),
)
MANAGERS = ADMINS
##DATABASES = {
## 'default': {
## 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
## 'NAME': '', # Or path to database file if using sqlite3.
## 'USER': '', # Not used with sqlite3.
## 'PASSWORD': '', # Not used with sqlite3.
## 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
## 'PORT': '', # Set to empty string for default. Not used with sqlite3.
## }
##}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = ''
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
ROOT_URLCONF = 'craigslist.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
#'kombu.transport.django',
#'djcelery',
'<problemappname>',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
BROKER_BACKEND = 'django'
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
# note that this becomes the following:
# DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': '',
# 'HOST': 'localhost',
# 'USER': None,
# 'PASSWORD': None,
# 'PORT': None } }
추가 편집 : 디렉토리 구조는 다음과 볼 수있는, 괄호 안의 주석. 세 번째 편집
- craigslist (project)
- craigslist
- __init__.py
- settings.py
- urls.py
- wsgi.py
- venv (virtualenv)
- Include (directory)
- Lib (directory)
- Scripts (directory)
- webpage (app)
- __init__.py
- models.py
- tests.py
- views.py
- __init__.py
- listings.py (custom module, not touched yet)
- manage.py
- requirements.txt
- settings.py
- urls.py
: 는 또한 내가 manage.py syncdb
을 실행할 때, 내가 대신 다음과 같은 오류를 얻을 도움이 될 수 생각 :
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\__init__.py", line 443, in execute_from_command_line
utility.execute()
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\base.py", line 232, in execute
output = self.handle(*args, **options)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\base.py", line 371, in handle
return self.handle_noargs(**options)
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\core\management\commands\syncdb.py", line 57, in handle_noargs
cursor = connection.cursor()
File "C:\Users\JJ\Documents\Coding Fun\craigslist\venv\lib\site-packages\djang
o\db\backends\dummy\base.py", line 15, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly co
nfigured. Please supply the ENGINE value. Check settings documentation for more
details.
또 다른 편집 : , 여기 요청으로 내 models.py
입니다.
# models.py
from django.db import models
# Create your models here.
class listing(models.Model):
body = models.CharField(max_length=10000)
title = models.CharField(max_length=400)
url = models.URLField(primary_key = True)
scraping_time = models.DateTimeField()
phone = models.CharField(max_length=20)
posting_time = models.DateTimeField()
email = models.EmailField()
# imglist as separate model
def __str__(self):
return self.title
class imagelist(models.Model):
listing = models.ForeignKey(listing)
img_url = models.URLField()
def __str__(self):
return self.img_url
관련 설정을 게시하시기 바랍니다. – armonge
완료, 감사의 말씀을드립니다. – jdotjdot
확인한 내용을 모두 포함시켜주십시오. 예를 들어,이 질문을 확인 했습니까? http://stackoverflow.com/questions/6483636/how-to-test-django-application-placed-in-subfolder –