Django: IE doesn't load localhost or loads very SLOWLY

后端 未结 5 2055
迷失自我
迷失自我 2021-01-12 03:40

I\'m just starting to learn Django, building a project on my computer, running Windows 7 64-bit, Python 2.7, Django 1.3.

Basically whatever I write, it loads in Chro

相关标签:
5条回答
  • 2021-01-12 03:56

    Sometimes it happens when you have unusual code like I have a line taking input from the users before HttpResponse. Remove that code and refresh the server. It will work like charm.

    0 讨论(0)
  • 2021-01-12 04:01

    It might be related to this issue: https://code.djangoproject.com/ticket/16099

    Essentially, the dev server isn't multithreaded, and if the browser opens a connection and then tries a second connection to actually get the data, it can hang forever.

    Edit:

    Also, see this issue: https://code.djangoproject.com/ticket/15178

    If you can provide a way to reproduce the issue, we may be able to find a fix.

    Also, if you could try the latest development version and see if that fixes it, we recently committed a new patch that adds multithreading capability to the runserver command.

    0 讨论(0)
  • 2021-01-12 04:11

    I'm not sure if you have the same problem as me. But I also bumped with the same white page on IE9 and apparently it was caused by html tag "fieldset" hides my form.

    Try to validate your html code or check html tags compatibility with IE9. Hope it helps.

    0 讨论(0)
  • 2021-01-12 04:11

    I am developing with Windows 7, 64bit, django 1.3, py 2.6 and I always check functionality of the Dev server in IE, Firefox, Safari, and Chrome. My newest system has IE9 on it and my old system has IE8. I also noticed the hanging problem. I found that when I used 127.0.0.1:8000 it hung and would take refreshed to get it to work. If I started the Dev server using the specific IP address of my dev server the problem seemed to be gone. For example python manage.py runserver 192.168.1.134:8000

    Does seem to be something very specific to IE9. an if you google it more people have been seeing this problem.

    0 讨论(0)
  • 2021-01-12 04:11

    i had this issue too, this workaround does the fix. works only for django <= 1.3
    http://nedbatchelder.com/blog/201103/quick_and_dirty_multithreaded_django_dev_server.html

    @Andrew Barber
    EDIT summary/how i did that:
    create a file named managec.py (c=concurrent)
    paste the following code in there:

    #!/usr/bin/env python
    # 
    # A clone of manage.py, with multi-threadedness monkeypatched in.
    
    import os, sys
    from django.core.management import execute_manager
    try:
        import settings # Assumed to be in the same directory.
    except ImportError:
        sys.stderr.write(
            "Error: Can't find the file 'settings.py' in the directory containing %r. "
            "It appears you've customized things.\n"
            "You'll have to run django-admin.py, passing it your settings module.\n"
            "(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" 
            % __file__
            )
        sys.exit(1)
    
    def monkey_patch_for_multi_threaded():
        # This monkey-patches BaseHTTPServer to create a base HTTPServer class that 
        # supports multithreading 
        import BaseHTTPServer, SocketServer 
        OriginalHTTPServer = BaseHTTPServer.HTTPServer
    
        class ThreadedHTTPServer(SocketServer.ThreadingMixIn, OriginalHTTPServer): 
            def __init__(self, server_address, RequestHandlerClass=None): 
                OriginalHTTPServer.__init__(self, server_address, RequestHandlerClass) 
    
        BaseHTTPServer.HTTPServer = ThreadedHTTPServer
    
    if __name__ == "__main__":
        monkey_patch_for_multi_threaded()
        execute_manager(settings)
    


    start your dev server with ./managec.py runserver 8080 (or whatever port you use)
    enjoy :)

    0 讨论(0)
提交回复
热议问题