由PyInstaller在Ubuntu上构建的Django可执行应用找不到静态文件

时间:2019-02-02 04:16:29

标签: django python-3.x pyinstaller

在基于Django-1.8开发并由PyInstaller3.4转换的Ubuntu 18.04上运行可执行应用程序时,出现以下错误。

TypeError at /static/css/style.css
expected str, bytes or os.PathLike object, not NoneType
Request Method: GET
Request URL:    http://localhost:8000/static/css/style.css
Django Version: 1.8
Exception Type: TypeError
Exception Value:    
expected str, bytes or os.PathLike object, not NoneType
Exception Location: django/views/static.py in serve, line 54
Python Executable:  /home/ksi/Projects/abcalarm/dist/webapp/webapp
Python Version: 3.6.7
Python Path:    
['/home/ksi/Projects/abcalarm/dist/webapp/base_library.zip',
 '/home/ksi/Projects/abcalarm/dist/webapp']
Server time:    Fri, 1 Feb 2019 15:52:36 +0000

Traceback Switch to copy-and-paste view
django/core/handlers/base.py in get_response
                                response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
django/views/static.py in serve
                fullpath = os.path.join(document_root, newpath) ...
▶ Local vars

当我在开发环境中运行Django源代码时,它运行正常。但是PyInstaller转换后的应用程序找不到静态路径。

0 个答案:

没有答案