Django ImportError on Heroku
Question: I tried several things to get my app working on heroku, but now I'm out of
ideas. I can install my project on heroku's rep, but I get a 500 error code.
My application works very well using virtualenv on my machine after I followed
the steps described on heroku documentation for django.

When I do my "git push heroku master" and try in browser, I get the following
error:

    
    
    2013-07-07T15:39:11.170514+00:00 app[web.1]: ImportError: No module named apps.base
    2013-07-07T15:39:11.170059+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/dateformat.py", line 35, in format
    2013-07-07T15:39:11.170202+00:00 app[web.1]:     app = import_module(appname)
    2013-07-07T15:39:11.170202+00:00 app[web.1]:     default_translation = _fetch(settings.LANGUAGE_CODE)
    2013-07-07T15:39:11.170202+00:00 app[web.1]:     _default = translation(settings.LANGUAGE_CODE)
    

I tought it was caused by a directory structure that wasn't supported on
heroku, so I adjusted it from the default one that was created with django
startproject command.

Here is my new file structure. I adjusted the import reference everywhere and
as I said, I works pefctly in local:

    
    
    manage.py
    Procfile
    requirements.txt
    vielfaltig
    |____apps
    | |____base
    | | |____models.py
    | | |____templates
    | | |____tests.py
    | | |____urls.py
    | | |____views.py
    | |____projects
    | | |____admin.py
    | | |____models.py
    | | |____templates
    | | |____templatetags
    | | |____tests.py
    | | |____translation.py
    | | |____urls.py
    | | |____views.py
    |____locale
    |____media
    |____settings.py
    |____static
    |____urls.py
    |____vielfaltig.db
    |____wsgi.py
    

As you notice, I have 2 apps (base and projects). In the code, I import them
using "vielfaltig.apps.base" for example. I changed this everywhere. I had
this error before and I changed the directory structure according to what I
read when I googled the error. I also tried to put everything in the root
directory (along with the requirements.txt and procfile). I don't know why it
keeps telling me an ImportError for "apps.base" while I reference the app
using "vielfaltif.apps.base" everywhere... ?

Does anyone have an idea? I will paste my settings.py if needed. For now I
think it would just take a lot of space.

Thank you very much for any help !


Answer: I guess it will work with `import vielfaltig.apps.base` instead of
`apps.base`. It can be fixed if you insert path `vielfaltig` to python system
path in your `settings.py`

    
    
    import sys
    
    sys.path.append('vielfaltig')
    

