0
我創建djnago項目followong靜態文件是Pyinstaller不能找到
mysite
--settings.py
-- urls.py
--wsgi.py
polls(app)
--static
--polls
--images
--templates
--polls
index.html
results.html
admin.py
apps.py
models.py
urls.py
views.py
我一直在使用pyinstaller 是exe文件運行良好能夠加載模板 但對靜態文件(CSS創建安裝項目的目錄結構和JS),exe文件給我的錯誤
C:\Users\sanjad\Desktop\testdemo\myinstaller>dist\manage\manage.exe runserver
Performing system checks...
System check identified no issues (0 silenced).
January 03, 2017 - 10:10:15
Django version 1.10.2, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[03/Jan/2017 10:10:18] "GET/HTTP/1.1" 200 346
Not Found: /static/polls/style.css
[03/Jan/2017 10:10:18] "GET /static/polls/style.css HTTP/1.1" 404 2605
以下是我的.spec文件
# -*- mode: python -*-
block_cipher = None
a = Analysis(['..\\mysite\\manage.py'],
pathex=['C:\\Users\\sanjad\\Desktop\\testdemo\\myinstaller'],
binaries=None,
datas=[
('C:\\Users\\sanjad\\Desktop\\testdemo\\mysite\\polls\\templates\\','polls\\templates'),
('C:\\Users\\sanjad\\Desktop\\testdemo\\mysite\\polls\\static\\','polls\\static')
],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='manage',
debug=False,
strip=False,
upx=True,
console=True)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='manage')
你見過https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong –
是的,我已經看到了 –