Django - Helicon Zoo - Ошибка чтения серверной части приложения
Django на чистом экземпляре Server 2012R2 (Amazon EC2)
Я попытался настроить сайт django, используя инструкции, найденные здесь: Настройка Helicon Zoo Django
Я использую модуль Helizon Zoo версии 3.1.98.538 (это из бета-версии, как предлагается здесь: Helicon zoo forum)
Просматривая localhost / ZooPythonProject, я получаю базовую страницу проекта python, это работает до того, как я установлю django.
После установки django и изменения параметров в файле web.config, как предлагается, после обновления страницы появляется ошибка внутреннего сервера 500:
-
Error:
Helicon Zoo module has caught up an error. Please see the details below.
Worker Status:
The process was created
Windows error:
The pipe has been ended. (ERROR CODE: 109)
Internal module error:
message: Application backend read Error. type: ZooException file: App\Jobs\JobBase.cpp line: 531 version: 3.1.98.538
STDERR:
Empty stderr
Environment variables:
ALLUSERSPROFILE C:\ProgramData
APPDATA C:\Windows\system32\config\systemprofile\AppData\Roaming
APPL_ID ZooPythonProject
APPL_PHYSICAL_PATH C:\inetpub\wwwroot\ZooPythonProject
APPL_PHYSICAL_SHORT_PATH C:\inetpub\wwwroot\ZOOPYT~1
APPL_VIRTUAL_PATH /ZooPythonProject
APP_POOL_CONFIG C:\inetpub\temp\apppools\ZooPythonProject\ZooPythonProject.config
APP_POOL_ID ZooPythonProject
COMMONPROGRAMFILES C:\Program Files\Common Files
COMMONPROGRAMFILES(X86) C:\Program Files (x86)\Common Files
COMMONPROGRAMW6432 C:\Program Files\Common Files
COMPUTERNAME WIN-IAK09MB251B
COMSPEC C:\Windows\system32\cmd.exe
CONSOLE_URL console
DEPLOY_FILE deploy.py
DJANGO_SETTINGS_MODULE project.settings
ERROR_LOG_DIR log
FP_NO_HOST_CHECK NO
HOST 127.0.0.1
IIS_BINDNGS http=*:80:
INSTANCE_ID 1
LOCALAPPDATA C:\Windows\system32\config\systemprofile\AppData\Local
NUMBER_OF_PROCESSORS 1
OS Windows_NT
PATH C:\inetpub\wwwroot\ZooPythonProject\venv\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Program Files\Microsoft\Web Platform Installer\
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE AMD64
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
PROCESSOR_LEVEL 6
PROCESSOR_REVISION 3e04
PROGRAMDATA C:\ProgramData
PROGRAMFILES C:\Program Files
PROGRAMFILES(X86) C:\Program Files (x86)
PROGRAMW6432 C:\Program Files
PSMODULEPATH C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\AWS Tools\PowerShell\
PUBLIC C:\Users\Public
PYTHONPATH C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages;C:\inetpub\wwwroot\ZooPythonProject\venv\lib;C:\inetpub\wwwroot\ZooPythonProject;C:\inetpub\wwwroot\ZooPythonProject\project
SITE_NAME DEFAULT WEB SITE
SITE_PHYSICAL_PATH C:\inetpub\wwwroot
SYSTEMDRIVE C:
SYSTEMROOT C:\Windows
TEMP C:\Windows\TEMP
TMP C:\Windows\TEMP
USERDOMAIN WORKGROUP
USERNAME WIN-IAK09MB251B$
USERPROFILE C:\Windows\system32\config\systemprofile
VIRTUAL_ENV C:\inetpub\wwwroot\ZooPythonProject\venv
WINDIR C:\Windows
Helicon Zoo engine settings
appName python.project
appFullPath C:\python27\python.exe
appDirectory C:\inetpub\wwwroot\ZooPythonProject
appArguments C:\Zoo\Workers\python\zoofcgi.py
deployArguments
transportName NamedPipe
protocol fastcgi
scriptProcessor python.2.7.wsgi
errorLogDir C:\inetpub\wwwroot\ZooPythonProject\log
postBufferDir
watchFileChangesMask
host 127.0.0.1
port %PORT%
proxyPass
minInstances 1
maxInstances 1
minRequestsPerWorker 3
maxRequestsPerWorker 15
portLower 49152
portUpper 65535
workerRequestTimeout 30
timeLimit 0
postBuffer 1024
memoryLimit 0
gracefulShutdownTimeout 30
Web.config variables
APPL_ID ZooPythonProject
APPL_PHYSICAL_PATH C:\inetpub\wwwroot\ZooPythonProject
APPL_PHYSICAL_SHORT_PATH C:\inetpub\wwwroot\ZOOPYT~1
APPL_VIRTUAL_PATH /ZooPythonProject
CONSOLE_URL console
DEPLOY_FILE deploy.py
DJANGO_SETTINGS_MODULE project.settings
ERROR_LOG_DIR log
HOST 127.0.0.1
IIS_BINDNGS http=*:80:
INSTANCE_ID 1
PATH C:\inetpub\wwwroot\ZooPythonProject\venv\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Program Files\Microsoft\Web Platform Installer\
PYTHONPATH C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages;C:\inetpub\wwwroot\ZooPythonProject\venv\lib;C:\inetpub\wwwroot\ZooPythonProject;C:\inetpub\wwwroot\ZooPythonProject\project
SITE_NAME DEFAULT WEB SITE
SITE_PHYSICAL_PATH C:\inetpub\wwwroot
VIRTUAL_ENV C:\inetpub\wwwroot\ZooPythonProject\venv
Вот рабочий журнал ошибок:
No handlers could be found for logger "django.request"
Traceback (most recent call last):
File "C:\Zoo\Workers\python\zoofcgi.py", line 1069, in <module>
run_django_app(options.django_settings_module, options.django_root)
File "C:\Zoo\Workers\python\zoofcgi.py", line 999, in run_django_app
FCGIServer(WSGIHandler(), app_root=django_root).run()
File "C:\Zoo\Workers\python\zoofcgi.py", line 776, in run
conn.run()
File "C:\Zoo\Workers\python\zoofcgi.py", line 569, in run
self.process_input()
File "C:\Zoo\Workers\python\zoofcgi.py", line 600, in process_input
self._do_stdin(rec)
File "C:\Zoo\Workers\python\zoofcgi.py", line 724, in _do_stdin
self._start_request(req)
File "C:\Zoo\Workers\python\zoofcgi.py", line 697, in _start_request
req.run()
File "C:\Zoo\Workers\python\zoofcgi.py", line 515, in run
protocolStatus, appStatus = self.server.handler(self)
File "C:\Zoo\Workers\python\zoofcgi.py", line 862, in handler
result = self.application(environ, start_response)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\core\handlers\wsgi.py", line 187, in __call__
response = self.get_response(request)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\core\handlers\base.py", line 199, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\core\handlers\base.py", line 236, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\views\debug.py", line 91, in technical_500_response
html = reporter.get_traceback_html()
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\views\debug.py", line 350, in get_traceback_html
return t.render(c)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\template\base.py", line 148, in render
return self._render(context)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\template\base.py", line 142, in _render
return self.nodelist.render(context)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\template\base.py", line 844, in render
bit = self.render_node(node, context)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\template\debug.py", line 80, in render_node
return node.render(context)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\template\debug.py", line 90, in render
output = self.filter_expression.resolve(context)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\template\base.py", line 624, in resolve
new_obj = func(obj, *arg_vals)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\template\defaultfilters.py", line 769, in date
return format(value, arg)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\dateformat.py", line 343, in format
return df.format(format_string)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\dateformat.py", line 35, in format
pieces.append(force_text(getattr(self, piece)()))
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\dateformat.py", line 268, in r
return self.format('D, j M Y H:i:s O')
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\dateformat.py", line 35, in format
pieces.append(force_text(getattr(self, piece)()))
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\encoding.py", line 85, in force_text
s = six.text_type(s)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\functional.py", line 144, in __text_cast
return func(*self.__args, **self.__kw)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\translation\__init__.py", line 83, in ugettext
return _trans.ugettext(message)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\translation\trans_real.py", line 325, in ugettext
return do_translate(message, 'ugettext')
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\translation\trans_real.py", line 306, in do_translate
_default = translation(settings.LANGUAGE_CODE)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\translation\trans_real.py", line 209, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\inetpub\wwwroot\ZooPythonProject\venv\lib\site-packages\django\utils\translation\trans_real.py", line 189, in _fetch
"The translation infrastructure cannot be initialized before the "
django.core.exceptions.AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
ZooError-0-
[08.11.2014 22:08:55.451521] [v 3.1.98.538] [tid 0x000008d8] [sev 2] # 29876311008 Application has been started
[08.11.2014 22:08:55.545260] [v 3.1.98.538] [tid 0x000008d8] [sev 2] # 29876234512 Application has been terminated
ate log file C:\inetpub\wwwroot\ZooPythonProject\log\python.project [2014_11_08 22_08_55] worker-1.log
[08.11.2014 22:08:56.154595] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - OnProcessExit()
[08.11.2014 22:08:56.154595] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker shutdown. #2 - [pid:3276] "C:\python27\python.exe" C:\Zoo\Workers\python\zoofcgi.py
[08.11.2014 22:09:25.467110] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker closed. #2
[08.11.2014 22:10:02.092102] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - OnProcessExit()
[08.11.2014 22:10:02.092102] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker shutdown. #3 - [pid:2380] "C:\python27\python.exe" C:\Zoo\Workers\python\zoofcgi.py
[08.11.2014 22:10:25.467595] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker closed. #3
[08.11.2014 22:13:34.654735] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - OnProcessExit()
[08.11.2014 22:13:34.654735] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker shutdown. #4 - [pid:3852] "C:\python27\python.exe" C:\Zoo\Workers\python\zoofcgi.py
[08.11.2014 22:13:56.248576] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker closed. #4
[08.11.2014 22:14:13.139178] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - OnProcessExit()
[08.11.2014 22:14:13.139178] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker shutdown. #5 - [pid:2228] "C:\python27\python.exe" C:\Zoo\Workers\python\zoofcgi.py
[08.11.2014 22:14:26.342332] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker closed. #5
[08.11.2014 22:16:54.342382] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - OnProcessExit()
[08.11.2014 22:16:54.342382] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker shutdown. #6 - [pid:2496] "C:\python27\python.exe" C:\Zoo\Workers\python\zoofcgi.py
[08.11.2014 22:16:56.357999] [v 3.1.98.538] [tid 0x00000a9c] [sev 2] WorkersManager - Worker closed. #6
Настройки проекта Django.py:
"""
Django settings for project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '5jd%y7umf(o%0xa02nd@=(wl(z$$j#nyje^u=*19r*6kg$wfto'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'project.urls'
WSGI_APPLICATION = 'project.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
},
},
'handlers': {
'default': {
'level':'DEBUG',
'class':'logging.handlers.RotatingFileHandler',
'filename': 'logs/mylog.log',
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 5,
'formatter':'standard',
},
'request_handler': {
'level':'DEBUG',
'class':'logging.handlers.RotatingFileHandler',
'filename': 'logs/django_request.log',
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 5,
'formatter':'standard',
},
},
'loggers': {
'': {
'handlers': ['default'],
'level': 'DEBUG',
'propagate': True
},
'django.request': {
'handlers': ['request_handler'],
'level': 'DEBUG',
'propagate': False
},
}
}
2 ответа
Путем проб и ошибок и публикации на форуме Геликон
Я обнаружил, что это просто ошибка с новейшей версией Django 1.7
После того, как программа установки helicon создаст виртуальную среду (или шаблон Python), вместо этого установите django 1.6
pip install django==1.6
Автоматизация конфигурации сервера может быть проблемой, и я уверен, что они решают эту проблему, надеюсь, что немного более старая версия не проблема для вас.
Если это рабочий сервер, который вы все еще хотите выполнить из-за возможных последствий для безопасности, возможно, проверьте журнал изменений django 1.7
Вам нужно определить логгер в настройках Django, примерно так:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}