'NoneType' object is not iterable

934 views
Skip to first unread message

Javi

unread,
Nov 4, 2008, 12:35:06 PM11/4/08
to Django users
Hello everybody!
I'm using django 1.0-1 version and Apache as a server web. In the dev
server everything works fine but in the production server I get the
following error when I ask for a url:

NoneType' object is not iterable

Request Method: POST
Request URL: http://localhostenter/
Exception Type: TypeError
Exception Value:

'NoneType' object is not iterable

Exception Location: /var/lib/python-support/python2.5/django/core/
handlers/base.py in get_response, line 77
Python Executable: /usr/bin/python
Python Version: 2.5.2

I think it's because the "/" after "localhost" is not added, actually
the url in the browser is http://localhost/enter/

I've been reading about the problem and someone speaks about creating
a middleware class... I don't know...

Is there another simpler way to sort the problem out?

Thanks in advance.

Greetings.

Xiong Chiamiov

unread,
Nov 4, 2008, 1:07:11 PM11/4/08
to Django users
If it works in one environment, but not another, then it might have
something to do with your settings files. When you create your links,
are you having the href be "/enter" or "/enter/"? I think the
middleware class you're reading about is for trailing slashes, not
preceeding ones.

On Nov 4, 9:35 am, Javi <JavierPe...@gmail.com> wrote:
> Hello everybody!
> I'm using django 1.0-1 version and Apache as a server web. In the dev
> server everything works fine but in the production server I get the
> following error when I ask for a url:
>
> NoneType' object is not iterable
>
> Request Method:         POST
> Request URL:    http://localhostenter/
> Exception Type:         TypeError
> Exception Value:
>
> 'NoneType' object is not iterable
>
> Exception Location:     /var/lib/python-support/python2.5/django/core/
> handlers/base.py in get_response, line 77
> Python Executable:      /usr/bin/python
> Python Version:         2.5.2
>
> I think it's because the "/" after "localhost" is not added, actually
> the url in the browser ishttp://localhost/enter/

Javi

unread,
Nov 4, 2008, 4:11:13 PM11/4/08
to Django users
Thanks but I'd already tried it. I don't understand why in the
production server is not added the preceeding slash to the url. My
urls.py is as follows:
urlpatterns = patterns('candidateTool.assessmentSystem.views',
(r'^$', 'index'),
(r'^enter/$', 'enter'),
(r'^main/$', 'main'),
(r'^exam/(?P<exam_id>\d+)/$', 'exam'),
(r'^myexam/(?P<exam_id>\d+)/$', 'my_exam'),
(r'^solved/(?P<exam_id>\d+)/$', 'solved_exam'),
(r'^report/$', 'report'),
(r'^exams/$', 'exams'),
(r'^admin/(.*)', admin.site.root),
)

In the index page is called /enter and I've also tried /enter/ but
neither work :(

Rajesh Dhawan

unread,
Nov 5, 2008, 1:11:41 PM11/5/08
to Django users
Hi Javi,

> Thanks but I'd already tried it. I don't understand why in the
> production server is not added the preceeding slash to the url. My
> urls.py is as follows:
> urlpatterns = patterns('candidateTool.assessmentSystem.views',
> (r'^$', 'index'),
> (r'^enter/$', 'enter'),
> (r'^main/$', 'main'),
> (r'^exam/(?P<exam_id>\d+)/$', 'exam'),
> (r'^myexam/(?P<exam_id>\d+)/$', 'my_exam'),
> (r'^solved/(?P<exam_id>\d+)/$', 'solved_exam'),
> (r'^report/$', 'report'),
> (r'^exams/$', 'exams'),
> (r'^admin/(.*)', admin.site.root),
> )
>
> In the index page is called /enter and I've also tried /enter/ but
> neither work :(

Try, putting FORCE_SCRIPT_NAME='' in your settings file.

Also, how are you running the application in your production server
(Apache/mod_python, lighttpd/flup, nginx/proxy, etc.)?

-RD

Javi

unread,
Nov 10, 2008, 5:35:45 AM11/10/08
to Django users
Hello Rajesh,

I've tried putting FORCE_SCRIPT_NAME="" but everything continues at
the same state. I'm running the app in Apache2/mod_python. I've pasted
the htttp.conf file at http://rafb.net/p/Ya1VKT55.html

I'm going to continue trying to solve it.

Diego Cibils

unread,
Nov 10, 2008, 9:07:55 AM11/10/08
to Django users
Hi Javi,

I'm having the same problem... any progress so far?

Thanks.

On Nov 10, 8:35 am, Javi <JavierPe...@gmail.com> wrote:
> Hello Rajesh,
>
> I've tried putting FORCE_SCRIPT_NAME="" but everything continues at
> the same state. I'm running the app in Apache2/mod_python. I've pasted
> the htttp.conf file athttp://rafb.net/p/Ya1VKT55.html

Zeddy

unread,
Nov 11, 2008, 3:23:48 PM11/11/08
to Django users
Same problem. Any suggestions?

I am using nginx with fapws2 (wsgi server). Looks like script kiddie
thinks that my web server is an open proxy (88.80.7.248 is NOT my IP
address):

Traceback (most recent call last):

File "/usr/local/lib/python2.5/site-packages/django/core/handlers/
base.py", line 77, in get_response
request.path_info)

TypeError: 'NoneType' object is not iterable


<WSGIRequest
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'HTTP_ACCEPT': '*/*',
'HTTP_HOST': '88.80.7.248',
'HTTP_PRAGMA': 'no-cache',
'HTTP_PROXY_CONNECTION': 'Keep-Alive',
'PATH_INFO': u'http://88.80.7.248/proxy-pool/set-cookie.php',
'QUERY_STRING': '',
'REQUEST_METHOD': 'GET',
'SCRIPT_NAME': u'',
'SERVER_NAME': '127.0.0.1',
'SERVER_PORT': 8080,
'fapws.http_major': 1,
'fapws.http_minor': 1,
'fapws.params': {},
'fapws.remote_host': '88.80.7.248',
'fapws.remote_port': 34609,
'fapws.uri': 'http://88.80.7.248/proxy-pool/set-cookie.php',
'wsgi.errors': <cStringIO.StringO object at 0x8f58e20>,
'wsgi.input': <cStringIO.StringO object at 0x8f552e0>,
'wsgi.multiprocess': True,
'wsgi.multithread': False,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}>


Rajesh Dhawan

unread,
Nov 11, 2008, 5:54:42 PM11/11/08
to Django users
Hi Javi,

> I've tried putting FORCE_SCRIPT_NAME="" but everything continues at
> the same state. I'm running the app in Apache2/mod_python. I've pasted
> the htttp.conf file athttp://rafb.net/p/Ya1VKT55.html

I can't see your conf file there. Perhaps you want to paste again at
http://dpaste.com/ ?

Take a look at the django.root PythonOption described here:

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from=olddocs#basic-configuration

Are you using that option? If, yes, remove that option entirely and
try again.

-Rajesh

Javi

unread,
Nov 12, 2008, 5:14:39 AM11/12/08
to Django users
It works!! Thank you very much!! The django.root PythonOption stripped
the initial "/"

Greetings.

On Nov 11, 11:54 pm, Rajesh Dhawan <rajesh.dha...@gmail.com> wrote:
> Hi Javi,
>
> > I've tried putting FORCE_SCRIPT_NAME="" but everything continues at
> > the same state. I'm running the app in Apache2/mod_python. I've pasted
> > the htttp.conf file athttp://rafb.net/p/Ya1VKT55.html
>
> I can't see your conf file there. Perhaps you want to paste again athttp://dpaste.com/?
>
> Take a look at the django.root PythonOption described here:
>
> http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from...
Reply all
Reply to author
Forward
0 new messages