title: Django-Celery Import Error: Cannot Import name current_app
body: <p>I'm packaging a Django app with PyInstaller. I get the following output when I attempt to run the final exe.</p>
  
  <pre><code>    Traceback (most recent call last):
      File "&lt;string&gt;", line 9, in &lt;module&gt;
      File "c:\users\alex\.virtualenvs\pychampion\lib\site-packages\PyInstaller-   2.1.1dev_-py2.7.egg\PyInstaller\loader\pyi_importers.py", line 270, in load_module exec(bytecode, module.__dict__)
      File "Z:\01. Python Development\pychamp\build\project\out00-PYZ.pyz\pychamp", line 4, in &lt;module&gt;
      File "c:\users\alex\.virtualenvs\pychampion\lib\site-packages\PyInstaller-2.1.1dev_-py2.7.egg\PyInstaller\loader\pyi_importers.py", line 270, in load_module exec(bytecode, module.__dict__)
      File "Z:\01. Python Development\pychamp\build\project\out00-PYZ.pyz\pychamp.settings", line 13, in &lt;module&gt;
      File "c:\users\alex\.virtualenvs\pychampion\lib\site-packages\PyInstaller-2.1.1dev_-py2.7.egg\PyInstaller\loader\pyi_importers.py", line 270, in load_module    exec(bytecode, module.__dict__)
      File "Z:\01. Python Development\pychamp\build\project\out00-PYZ.pyz\djcelery", line 22, in &lt;module&gt;
      ImportError: cannot import name current_app
  </code></pre>
  
  <p>The weird thing is that I only get this importerror after I've run pyInstaller. The app runs great before freezing. <a href="https://stackoverflow.com/questions/17371307/django-djcelery-import-error-from-celery-import-current-app-as-celery-in-virtua">This issue</a> seemed very similar to what I'm facing as I'm also running from a virtualenv, but renaming the project directory didn't do anything. My current structure is</p>
  
  <pre><code>    pychamp
      \--pychamp
         \--settings.py
      \--pyapp
      \--manage.py 
  </code></pre>
  
  <p>My guess is that it's another issue with PyInstaller not catching an import but I can't figure out what import I'm missing. Referencing the <a href="http://www.pyinstaller.org/wiki/Recipe/DjangoApplication" rel="nofollow noreferrer">Pyinstaller Recipe</a>, I've been putting some imports into the manage.py without any luck. I've read through as many different Google searches as I could to figure this out, but I've run out of ideas. Any help is greatly appreciated. </p>
  
  <pre><code>    from django.conf import settings
      from pychamp import settings
      import djcelery
      from django.template.loaders.filesystem import Loader
      from django.template.loaders.app_directories import Loader
      import django.template.defaulttags
      import django.template.defaultfilters
      import django.template.loader_tags
      import django.test
      import HTMLParser
      import django.contrib.sessions.serializers
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I never did figure out what was going on with Celery. I ended up reworking the code to not use Celery and this is my manage.py so pyinstaller would import all the needed libraries. </p>
  
  <pre><code>#!/usr/bin/env python
  import os
  import sys
  
  
  if __name__ == "__main__":
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pychamp.settings")
  
      from django.conf import settings
      import Cookie
      import django.test
      import HTMLParser
      import django.contrib.sessions.serializers
      import django.contrib
      import django.core.mail.backends.smtp
      import django.core.management.commands.sql
      import django.core.management.commands.sqlall
      import django.core.management.commands.sqlclear
      import django.core.management.commands.sqlinitialdata
      import django.core.management.commands.sqlsequencereset
      import django.template.loader
      import django.views.defaults
      import django.templatetags
      import googlecharts
      from googlecharts import templatetags
      from googlecharts.templatetags import googlecharts
      import django.core.serializers
      from django.core.serializers import json
      from django.templatetags import future
  
      from django.core.management import execute_from_command_line
  
      execute_from_command_line(sys.argv)
  </code></pre>