Skip to main content
 首页 » 编程设计

python之升级到 django 1.8 runserver 在启动时挂起

2024年10月24日2198°冷暖

我正在从 1.4 升级到 Django 1.8。升级后运行服务器在没有我的应用程序的情况下工作正常。但是当我将其中之一添加到 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 

请您参考如下方法:

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

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

  • 尝试 runserver_plus来自 django-extensions以获得更多反馈。

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

  • Here是来自 the Open edX group 的一些广泛注释目前正在将多个应用程序从 1.4 升级到 1.8。