django wsgi error -- __main__.TeeOutputStream object

Repository of web frameworks and applications for Microsoft IIS.
User avatar
Posts: 1
Joined: 07 Jul 2013, 18:13

django wsgi error -- __main__.TeeOutputStream object

07 Jul 2013, 18:39

I'm having trouble getting Zoo working with my pre-existing app using IIS 7.5. I have already set up the test application which worked, but moving too my actual app I am getting a wsgi error that does not produce any logs, which makes me think it's happening very early at startup. I have been able to run the application successfully (but sloooowly) by manually setting the pythonpath to what it is in the web.config file and running runserver like so:

Code: Select all
set PYTHONPATH="d:\mdid\python_modules\Lib\site-packages;c:\Python27;c:\Python27/Scripts;d:\mdid\rooibos;d:\mdid\rooibos\contrib;"
python rooibos/manage.py runserver


The app also runs successfully if I runserver without setting the pythonpath

(I'm using literal paths instead of the %SYSTEM_VARIABLES% to be sure I know what is happening)

Here is the github repo of the app I'm trying to install: https://github.com/cit-jmu/rooibos

I have the app installed at d:\mdid, with the django root at d:\mdid\rooibos

Here's my deploy.py:

Code: Select all
import sys
import os
import os.path
import shutil
import django

PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), 'rooibos'))
print PROJECT_DIR
os.chdir(PROJECT_DIR)

PIP_EXE = os.path.join(os.path.dirname(sys.executable), 'scripts\\pip.exe')

# update APPDATA env for pip
os.environ['APPDATA'] = os.path.join(PROJECT_DIR, 'python_modules')

# install requirements to local folder
os.system('{0} install --install-option="--prefix={1}\python_modules" --requirement=requirements.txt'.format(PIP_EXE, PROJECT_DIR))

# run manage.py syncdb --noinput
os.system(sys.executable + " d:\mdid\\rooibos\\manage.py syncdb --noinput")

# run manage.py migrate
os.system(sys.executable + " d:\mdid\\rooibos\\manage.py migrate")

# copy admin media files
if not os.path.exists(os.path.join(PROJECT_DIR, 'rooibos', 'static', 'admin', 'css', 'base.css')):
    print 'Copying admin media files'
    shutil.copytree(
      os.path.join(os.path.dirname(django.__file__), 'contrib', 'admin', 'media'),
      os.path.join(PROJECT_DIR, 'rooibos', 'static', 'admin'))
else:
    print 'Admin media files already copied'


and here's my web.config:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
  <heliconZoo>
   <application name="mdid" >
    <environmentVariables>
     <add name="PYTHONPATH"
          value="d:\mdid\python_modules\Lib\site-packages;c:\Python27;c:\Python27/Scripts;d:\mdid\rooibos;d:\mdid\rooibos\contrib;" />
     <add name="DJANGO_SETTINGS_MODULE" value="rooibos.settings" />
     <add name="django.root" value="rooibos" />
     <add name="DEPLOY_FILE" value="deploy.py" />
      <add name="ERROR_LOG_DIR"  value="log" />
     <add name="DEPLOY_LOG" value="log\deploy.log" />
     <add name="WATCH_FILE_CHANGES_MASK" value="*.py" />
    </environmentVariables>
   </application>
  </heliconZoo>
  <handlers>
   <add name="django.project#x86" scriptProcessor="python.2.7.wsgi"
        path="*" verb="*" modules="HeliconZoo_x86"
        preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
   <add name="django.project#x64" scriptProcessor="python.2.7.wsgi"
        path="*" verb="*" modules="HeliconZoo_x64"
        preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
  </handlers>
 </system.webServer>
</configuration>


I basically get a debug screen:

Code: Select all
APPL_MD_PATH: /LM/W3SVC/1/ROOT
APPL_PATH:
APPL_PHYSICAL_PATH: D:\mdidAUTH_PASSWORD:
AUTH_TYPE:
AUTH_USER:
CERT_COOKIE:
CERT_FLAGS:
CERT_ISSUER:
CERT_SERIALNUMBER:
CERT_SUBJECT:
CONTENT_LENGTH: 0
CONTENT_TYPE:
DOCUMENT_ROOT: D:\mdidGATEWAY_INTERFACE: CGI/1.1
HTTPS: off
HTTPS_KEYSIZE:
HTTPS_SECRETKEYSIZE:
HTTPS_SERVER_ISSUER:
HTTPS_SERVER_SUBJECT:
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: auth[removed]
HTTP_HOST: localhost
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
INSTANCE_ID: 1
INSTANCE_META_PATH: /LM/W3SVC/1
INSTANCE_NAME: MDID
LOCAL_ADDR: ::1
LOGON_USER:
PATH_INFO: /
PATH_TRANSLATED: D:\mdid
QUERY_STRING:
REMOTE_ADDR: ::1
REMOTE_HOST: ::1
REMOTE_PORT: 54668
REMOTE_USER:
REQUEST_METHOD: GET
REQUEST_URI: /
SCRIPT_FILENAME: D:\mdid
SCRIPT_NAME:
SERVER_NAME: localhost
SERVER_PORT: 80
SERVER_PORT_SECURE: 0
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Microsoft-IIS/7.5
URL: /
wsgi.errors: <__main__.TeeOutputStream object at 0x00EEF610>
wsgi.input: <__main__.InputStream object at 0x00EE7B10>
wsgi.multiprocess: False
wsgi.multithread: False
wsgi.run_once: False
wsgi.url_scheme: http
wsgi.version: (1, 0)
sys.version: 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]


My assumption is that something in the debug screen should be saying "d:\mdid\rooibos" but I'd appreciate any suggestions - thanks much!

User avatar
Posts: 110
Joined: 07 Mar 2012, 10:22

Re: django wsgi error -- __main__.TeeOutputStream object

08 Jul 2013, 06:15

Hello!

It seems that you have the wrong application name in handler names. Please fix them as follows (in web.config):

Code: Select all
<handlers>
  <add name="mdid#x86" ...
  <add name="mdid#x64" ...
</handlers>


Also you need add "d:\mdid" path in PYTHONPATH env:

Code: Select all
<add name="PYTHONPATH"
    value="d:\mdid;d:\mdid\rooibos;d:\mdid\rooibos\contrib;d:\mdid\python_modules\Lib\site-packages" />

Return to Helicon Zoo

Who is online

Users browsing this forum: No registered users and 2 guests