Not able to include html files and static content of django project to installer

955 views
Skip to first unread message

ragini dahihande

unread,
Dec 30, 2016, 2:03:48 AM12/30/16
to PyInstaller
I have created installer of django project using pyinstaller
The exe which had created using pyinstaller is running fine.
But I am not able to include html files and static files from jango project
How can we include these files ?

Hartmut Goebel

unread,
Dec 30, 2016, 5:06:25 AM12/30/16
to pyins...@googlegroups.com
Am 30.12.2016 um 08:03 schrieb ragini dahihande:
How can we include these files ?

This is written in the FAQ .

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: http://www.goebel-consult.de/blog/das-fass-ist-voll-grunde-linux-201asystemd2018-zu-meiden
Kolumne: http://www.cissp-gefluester.de/2012-04-compliance-bringt-keine-sicherheit

ragini dahihande

unread,
Jan 1, 2017, 11:27:20 PM1/1/17
to pyins...@googlegroups.com
Hi Hartmut,

I am not  able to find any question for this in FAQ.
Can you please help me ?

Thanks,
Ragini

--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/9AWQwpmMmag/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller+unsubscribe@googlegroups.com.
To post to this group, send email to pyins...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.



--
Hi,



Thanks And Regards,
Ragini Sanjay Dahihande
Dell EMC
| DataDomain
Mob : +91 9561196896
Don't stop when you're tired. Stop when you're done!

Steve Barnes

unread,
Jan 2, 2017, 2:29:05 AM1/2/17
to pyins...@googlegroups.com


On 02/01/2017 04:27, ragini dahihande wrote:
> Hi Hartmut,
>
> I am not able to find any question for this in FAQ.
> Can you please help me ?
>
> Thanks,
> Ragini
>
Ragini,

All static content, including html files, would be classed as "data
files" so take a look at
https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Collect-Data-Files

You should also be reading
https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Executable-From-Django


--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.

ragini dahihande

unread,
Jan 2, 2017, 4:54:21 AM1/2/17
to PyInstaller

See following is my project directory structure
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


when I run my project using manage.py its working fine
but when I am running through exe file getting error like template does not exist

https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Collect-Data-Files
these steps are not clear so I am not able to proceed

Hartmut Goebel

unread,
Jan 2, 2017, 5:15:41 AM1/2/17
to pyins...@googlegroups.com
Am 02.01.2017 um 05:27 schrieb ragini dahihande:
I am not  able to find any question for this in FAQ.

I have to admit that the FAQ does not answer the question. The manual does: <https://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-files-to-the-bundle>

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

ragini dahihande

unread,
Jan 2, 2017, 8:43:29 AM1/2/17
to PyInstaller
See I added datafiles path to .spec file

# -*- 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')

Now when running through exe pyinstaller able to load html files
but not able to load static files
following error I am getting

Enter code here...C:\Users\sanjad\Desktop\testdemo\myinstaller>dist\manage\manage.exe runserver
Performing system checks...

System check identified no issues (0 silenced).
January 02, 2017 - 19:10:14
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.
[02/Jan/2017 19:10:20] "GET / HTTP/1.1" 200 346
Not Found: /static/polls/style.css
[02/Jan/2017 19:10:20] "GET /static/polls/style.css HTTP/1.1" 404 2605

Hartmut Goebel

unread,
Jan 2, 2017, 9:21:44 AM1/2/17
to pyins...@googlegroups.com
Am 02.01.2017 um 14:43 schrieb ragini dahihande:
Now when running through exe pyinstaller able to load html files
but not able to load static files
following error I am getting

Please see the "if things so wrong" section of the manual or the wiki,

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Reply all
Reply to author
Forward
0 new messages