pyinstaller 3.2 with django 1.10.1
<p>System: windows 7 64 bit, python 3.5, anaconda 3 (64 bit) , django 1.10.1 </p>

<p>I'm trying to compile my django project in 2 ways:</p>

<p>First:</p>

<pre><code>[Anaconda3] c:\compilation\Gui&gt;pyinstaller --name=gui --exclude-module=PyQt4 --exclude-module=matplotlib --clean --win-private-assemblies manage.py 
</code></pre>

<p>Second according to <a href="http://stackoverflow.com/questions/34479049/pyinstaller-django-with-custom-admin-commands">this soloution</a>:</p>

<pre><code>[Anaconda3] c:\compilation\Gui&gt;pyinstaller --name=gui --exclude-module=PyQt4 --exclude-module=matplotlib --clean --win-private-assemblies --runtime-hook=pyi_rth_django.py manage.py
</code></pre>

<p>When I try to run the output: </p>

<pre><code>c:\compilation\Gui\dist\gui&gt;gui.exe runserver
</code></pre>

<p>I get (for the 2 versions I get the same output):</p>

<pre><code>c:\compilation\Gui\dist\gui&gt;gui.exe runserver
Unhandled exception in thread started by &lt;function check_errors.&lt;locals&gt;.wrapper at 0x00000000044E9D90&gt;
Traceback (most recent call last):
File "site-packages\django\utils\autoreload.py", line 226, in wrapper
File "site-packages\django\core\management\commands\runserver.py", line 113, in inner_run
File "site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
File "site-packages\django\utils\six.py", line 685, in reraise
File "site-packages\django\utils\autoreload.py", line 226, in wrapper
File "site-packages\django\__init__.py", line 27, in setup
File "site-packages\django\apps\registry.py", line 85, in populate
File "site-packages\django\apps\config.py", line 116, in create
File "importlib\__init__.py", line 126, in import_module
File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import
File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
File "&lt;frozen importlib._bootstrap&gt;", line 956, in _find_and_load_unlocked
ImportError: No module named 'django.contrib.admin.apps'
</code></pre>

<p>Please advice.</p>

<p>What is your files layout? According to these <code>pyinstaller</code> docs <a href="https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Executable-From-Django" rel="nofollow">https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Executable-From-Django</a> there could be two solutions.</p>

<ol>
<li><p>run your command from parent directory, i.e. instead of</p>

<pre><code>c:\compilation\Gui&gt;pyinstaller --name=gui manage.py
</code></pre>

<p>do</p>

<pre><code>c:\compilation&gt;pyinstaller --name=gui Gui\manage.py
</code></pre></li>
<li><p>try to add <code>import django.contrib.admin.apps</code> to your <code>manage.py</code> and make sure it exists</p></li>
<li><p><a href="https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Executable-From-Django#what-if-it-does-not-work" rel="nofollow">report bug</a></p></li>
</ol>

python django pyinstaller