【问题标题】:After upgrade to django 1.8 runserver hangs at startup升级到 django 1.8 后,runserver 在启动时挂起
【发布时间】:2015-11-04 19:42:42
【问题描述】:

我正在从 1.4 升级到 django 1.8。升级后 runserver 在没有我的应用程序的情况下可以正常工作。但是当我将其中一个添加到 installed_apps 时,它只会在启动时挂起。 命令:

C:\Programs\Python27\python.exe C:/Projects/prj/django/django_projects/manage.py runserver localhost:8080 --verbosity=3

并且没有提供输出(即使我使用 verbosity=3)。 这是为 python.exe http://clip2net.com/s/3pQPHSb 设置的 procmon 的屏幕截图 有什么方法可以调试它为什么挂起?

10:39:23.9166574 PM python.exe  7420    QueryDirectory  C:\Programs\Python27\Lib\site-packages\django\db\backends\logging   NO SUCH FILE    Filter: logging
10:39:23.9168061 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\db\backends\logging.pyd   NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:23.9169126 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\db\backends\logging.py    NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:23.9170179 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\db\backends\logging.pyw   NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:23.9171225 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\db\backends\logging.pyc   NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.0008918 PM python.exe  7420    CreateFile  C:\Programs\Python27\Lib\site-packages\django_loginas-0.1.5-py2.7.egg-info  SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
10:39:24.0009480 PM python.exe  7420    QueryBasicInformationFile   C:\Programs\Python27\Lib\site-packages\django_loginas-0.1.5-py2.7.egg-info  SUCCESS CreationTime: 3/21/2015 12:21:25 PM, LastAccessTime: 3/21/2015 12:21:26 PM, LastWriteTime: 3/21/2015 12:21:26 PM, ChangeTime: 3/21/2015 12:21:26 PM, FileAttributes: D
10:39:24.0009873 PM python.exe  7420    CloseFile   C:\Programs\Python27\Lib\site-packages\django_loginas-0.1.5-py2.7.egg-info  SUCCESS 
10:39:24.0201031 PM python.exe  7420    CreateFile  C:\programs\python27\lib\site-packages\django_loginas-0.1.5-py2.7.egg-info\namespace_packages.txt   NAME NOT FOUND  Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
10:39:24.0612018 PM python.exe  7420    CreateFile  C:\Programs\Python27\Lib\site-packages\django_loginas-0.1.5-py2.7.egg-info  SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
10:39:24.0612568 PM python.exe  7420    QueryBasicInformationFile   C:\Programs\Python27\Lib\site-packages\django_loginas-0.1.5-py2.7.egg-info  SUCCESS CreationTime: 3/21/2015 12:21:25 PM, LastAccessTime: 3/21/2015 12:21:26 PM, LastWriteTime: 3/21/2015 12:21:26 PM, ChangeTime: 3/21/2015 12:21:26 PM, FileAttributes: D
10:39:24.0612878 PM python.exe  7420    CloseFile   C:\Programs\Python27\Lib\site-packages\django_loginas-0.1.5-py2.7.egg-info  SUCCESS 
10:39:24.3178297 PM python.exe  7420    CloseFile   C:\Programs\Python27\Lib\site-packages\django\utils\log.py  SUCCESS 
10:39:24.3292991 PM python.exe  7420    QueryDirectory  C:\Programs\Python27\Lib\site-packages\django\middleware\logging    NO SUCH FILE    Filter: logging
10:39:24.3294485 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\middleware\logging.pyd    NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.3295557 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\middleware\logging.py NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.3296610 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\middleware\logging.pyw    NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.3297664 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\middleware\logging.pyc    NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.5965679 PM python.exe  7420    QueryDirectory  C:\Programs\Python27\Lib\site-packages\django\contrib\sessions\backends\logging NO SUCH FILE    Filter: logging
10:39:24.5967232 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\contrib\sessions\backends\logging.pyd NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.5968351 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\contrib\sessions\backends\logging.py  NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.5969426 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\contrib\sessions\backends\logging.pyw NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
10:39:24.5970523 PM python.exe  7420    CreateFile  C:\Programs\Python27\lib\site-packages\django\contrib\sessions\backends\logging.pyc NAME NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a

【问题讨论】:

    标签: python django


    【解决方案1】:

    显然,这些版本之间发生了很多变化,所以我怀疑是否需要进行简单的更改。以下是一些简化升级路径的建议:

    • 尝试使用中间版本运行您的应用,看看它何时开始挂起。这可能会为您提供有关需要更改的内容的线索。此外,您应该在增加版本时开始收到弃用警告。

    • django-extensions 尝试runserver_plus 可能会获得更多反馈。

    • 看看this post关于从1.4升级到1.7。

    • Here 是来自the Open edX group 的一些详细说明,目前正在将多个应用程序从 1.4 升级到 1.8。

    【讨论】:

    • 感谢您的建议。我知道它可能需要修复很多项目并且已经解决了一系列问题。但是这个有点棘手,因为没有提供调试输出。
    • @dbf 导致问题的应用程序是否可供我们查看?
    • 看起来我解决了这个问题。它是文件的导入(间接),它是作为独立脚本运行的设置(使用 django.setup() 调用) - 我用它来测试并忘记删除它。 django 1.4(setup_environ 在哪里)很好,挂在 1.8 和 1.6 错误(这就是我发现它的方式)。再次感谢您的建议!
    【解决方案2】:

    我遇到了这个问题。为我解决的问题是:

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': ':memory:',
        },
    }
    

    亲切的问候。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-17
      • 2015-09-12
      • 2019-09-15
      • 2016-10-07
      • 2017-01-30
      • 1970-01-01
      • 2018-07-31
      • 2015-06-15
      相关资源
      最近更新 更多