Hello
sorry for the n00b post...
I just updated my project on my host (OVH), got it running with cgi but I
have this error on every page I try to load:

TypeError at [whatever]
iteration over non-sequence

I guess this might be a url problem but I'm pretty new to django/python so I
have no clue of where to look...

my files architecture is:
/projects/blog # my django project
/projects/django
/www/.htaccess
/www/django.cgi

here are some infos:

# .htaccess ----------------------------------
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.cgi/$1 [L]
# EOF ----------------------------------


# django.cgi ----------------------------------
#!/usr/bin/env python
# encoding: utf-8

import os, sys

sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'django'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'projects'))
import django.core.handlers.wsgi

def run_with_cgi(application):

    environ                      = dict(os.environ.items())
    environ['wsgi.input']        = sys.stdin
    environ['wsgi.errors']       = sys.stderr
    environ['wsgi.version']      = (1,0)
    environ['wsgi.multithread']  = False
    environ['wsgi.multiprocess'] = True
    environ['wsgi.run_once']     = True

    if environ.get('HTTPS','off') in ('on','1'):
        environ['wsgi.url_scheme'] = 'https'
    else:
        environ['wsgi.url_scheme'] = 'http'

    headers_set  = []
    headers_sent = []

    def write(data):
        if not headers_set:
             raise AssertionError("write() before start_response()")

        elif not headers_sent:
             # Before the first output, send the stored headers
             status, response_headers = headers_sent[:] = headers_set
             sys.stdout.write('Status: %s\r\n' % status)
             for header in response_headers:
                 sys.stdout.write('%s: %s\r\n' % header)
             sys.stdout.write('\r\n')

        sys.stdout.write(data)
        sys.stdout.flush()

    def start_response(status,response_headers,exc_info=None):
        if exc_info:
            try:
                if headers_sent:
                    # Re-raise original exception if headers sent
                    raise exc_info[0], exc_info[1], exc_info[2]
            finally:
                exc_info = None     # avoid dangling circular ref
        elif headers_set:
            raise AssertionError("Headers already set!")

        headers_set[:] = [status,response_headers]
        return write

    result = application(environ, start_response)
    try:
        for data in result:
            if data:    # don't send headers until body appears
                write(data)
        if not headers_sent:
            write('')   # send headers now if body was empty
    finally:
        if hasattr(result,'close'):
            result.close()

# Change this to the directory above your site code.
#sys.path.append("/home/mycode")
# Change mysite to the name of your site package
os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'

try:
  run_with_cgi(django.core.handlers.wsgi.WSGIHandler())
except Exception, inst:
  print "Content-type: text/html\n\n"
  print inst
# EOF ----------------------------------



# urls.py ----------------------------------

import os

def rel(*x):
    return os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
    (r'^$', 'blog.posts.views.intro'),
    (r'^contact/$', 'blog.posts.views.contactview'),
    (r'^contact/thanks/$', 'blog.posts.views.thanks'),
    (r'^(?P<cat_name>\w+)/$', 'blog.posts.views.dispatch'),
    (r'^(?P<cat_name>\w+)/(?P<subcat_name>\w+)/$',
'blog.posts.views.sublist'),
)
# EOF ----------------------------------


sorry for the long post...
any help greatly apreciated !

cheers,
_y
ps: this project works perfectly locally
pps: django rules !

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to