开发者

I keep Getting KeyError: 'tried' Whenever I Tried to Run Django Dev Server from Remote Machine

开发者 https://www.devze.com 2023-01-03 06:11 出处:网络
I am running django 1.1.1 on python2.6.1, and did start thedjango web server like this manage.py runserver 192.0.0.1:8000

I am running django 1.1.1 on python2.6.1, and did start the django web server like this

manage.py runserver 192.0.0.1:8000

then tried to connect to the django dev web server on http://192.0.0.1:8000/

keep getting this message on the remote computer

Traceback (most recent call last):

  File "C:\Python26\Lib\site-packages\django\core\servers\basehttp.py", line 279, in run
    self.result = application(self.environ, self.start_response)

  File "C:\Python26\Lib\site-packages\django\core\servers\basehttp.py", line 651, in __call__
    return self.application(environ, start_response)

  File "C:\Python26\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__
    response = self.get_response(request)

  File "C:\Python26\lib\site-packages\django\core\handlers\base.py", line 115, in get_response
    return debug.technical_404_response(request, e)

  File "C:\Python26\Lib\site-packages\django\views\debug.py", line 247, in technical_404_response
    tried = exception.args[0]['tried']

KeyErro开发者_Python百科r: 'tried'

what i am doing wrong ?

it seen to work ok if i run http://192.0.0.1:8000/ on the computer that runs the Django web server and have that ip 192.0.0.1:8000


If you look at the revision logs of that file you'll see that django has recently started catching the KeyError that is raised in that try block.

The log message reads "Ensured generating debug 404 page won't raise a key error. Thanks pigletto."

See the ticket http://code.djangoproject.com/ticket/12083 and the changeset http://code.djangoproject.com/changeset/12679

So, I would check if you're raising a debug 404 page, or if any of the other comments in the ticket jump out of you.

Hope that helps!

Update: After looking at the code a little bit closer, I'd take a good look at your urls.py file for any mistakes in the url resolving regex. Are you doing url('') instead of ('^$') for the root/homepage?

0

精彩评论

暂无评论...
验证码 换一张
取 消