title: Pyinstaller compiles but 404 error on Django Static javascript files
body: <p>I've managed to get my applications to compile, but anytime it references a static file I receive a 404 error on my javascript files.  I verified they do exist in the dist application.</p>
  
  <p>My application structure is setup as the following:</p>
  
  <p><a href="https://i.stack.imgur.com/TNtDJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TNtDJ.png" alt="enter image description here"></a></p>
  
  <p>I've added my static files to the datas of the .spec file as shown below:</p>
  
  <pre><code># -*- mode: python -*-
  
  block_cipher = None
  
  
  a = Analysis(['manage.py'],
               pathex=['C:\\python\\dsssecurity'],
               binaries=[],
               datas=[('mysite/static','static_root'),('mysite/search/templates','mysite/templates')],
               hiddenimports=['django_select2.apps','django.contrib.admin.apps','django.contrib.auth.apps','django.contrib.contenttypes.apps','django.contrib.sessions.apps','django.contrib.messages.apps','django.contrib.staticfiles.apps','django_filters.apps','widget_tweaks.apps','django.contrib.messages.middleware.apps','django.template.loaders.apps'],
               hookspath=['C:/Python/dsssecurity'],
               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='dsssecurity',
            debug=False,
            strip=False,
            upx=True,
            console=True )
  coll = COLLECT(exe,
                 a.binaries,
                 a.zipfiles,
                 a.datas,
                 strip=False,
                 upx=True,
                 name='dsssecurity')
  </code></pre>
  
  <p>I've also added the static settings to my mysite > search > urls.py as shown below:</p>
  
  <pre><code>from django.conf.urls import url, include
  from django.contrib import admin
  from . import views
  from django.conf import settings
  from django.conf.urls.static import static
  
  
  urlpatterns = [
      url(r'^results/$', views.results, name='results'),
      url(r'^submitted/$', views.submitted, name='submitted'),
      url(r'^update/$', views.update, name='update'),
      url(r'^submittedupdate/$', views.submittedupdate, name='submittedupdate'),
  ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  </code></pre>
  
  <p>my output of the console shows:</p>
  
  <pre><code>[22/Jun/2018 14:24:02] "GET /search/?employeentname=&amp;employeelastname=&amp;qv_statusid=1&amp;employee_status_id=1&amp;title=&amp;coid= HTTP/1.1" 200 841390
  [22/Jun/2018 14:24:10] "POST /search/results/ HTTP/1.1" 200 36667
  Not Found: /static/search/selectallrep.js
  Not Found: /static/search/selectall.js
  Not Found: /static/search/rolebased.js
  [22/Jun/2018 14:24:10] "GET /static/search/selectall.js HTTP/1.1" 404 2354
  Not Found: /static/search/buttonsubmit.js
  [22/Jun/2018 14:24:10] "GET /static/search/selectallrep.js HTTP/1.1" 404 2363
  [22/Jun/2018 14:24:10] "GET /static/search/rolebased.js HTTP/1.1" 404 2354
  [22/Jun/2018 14:24:10] "GET /static/search/buttonsubmit.js HTTP/1.1" 404 2363
  Not Found: /static/search/buttonsubmit.js
  [22/Jun/2018 14:24:10] "GET /static/search/buttonsubmit.js HTTP/1.1" 404 2363
  Not Found: /static/search/selectall.js
  [22/Jun/2018 14:24:10] "GET /static/search/selectall.js HTTP/1.1" 404 2354
  Not Found: /static/search/selectallrep.js
  [22/Jun/2018 14:24:10] "GET /static/search/selectallrep.js HTTP/1.1" 404 2363
  Not Found: /static/search/rolebased.js
  [22/Jun/2018 14:24:10] "GET /static/search/rolebased.js HTTP/1.1" 404 2354
  </code></pre>
  
  <p>I've followed instructions shown here:</p>
  
  <p><a href="https://stackoverflow.com/questions/39193073/location-of-static-files-when-creating-a-django-exe-using-pyinstaller">Location of static files when creating a Django exe using pyinstaller</a></p>
  
  <p>and </p>
  
  <p><a href="https://github.com/pyinstaller/pyinstaller/issues/2348" rel="nofollow noreferrer">https://github.com/pyinstaller/pyinstaller/issues/2348</a></p>
  
  <p>My static_url and staticfiles_dirs in settings is defined as:</p>
  
  <pre><code>STATIC_URL = '/static/'
  
  STATICFILES_DIRS = (
      os.path.join(BASE_DIR, 'mysite/static'),
  )
  </code></pre>
  
  <p>My application works fine when running manage.py stand alone.  What am I missing to get my static files to be recognized in my pyinstaller executable?</p>