Search code examples
pythondjangomezzaninepythonanywhere

PythonAnywhere->ImportError raised loading nrpccms.newsroom.templatetags.blog_extras: No module named settings


I'm trying to deploy my very first app in PythonAnywhere (or at AnywhereAnywhere for that matter). I'm currently getting:

TemplateSyntaxError: 'blog_extras' is not a valid tag library: ImportError raised loading nrpccms.newsroom.templatetags.blog_extras: No module named settings

full error log
see error live

The app newsroom is the very first one in INSTALLED_APPS:

#! python
# ...
INSTALLED_APPS = (
    "nrpccms.newsroom",
    "django.contrib.admin",
# ...

blog_extras.py is at MY_PROJECT/MY_APP/templatetags and there is a __init__.py at MY_PROJECT/mY_APP.

Can you pinpoint my mistakes?


Solution

  • Fixed: I had to add my projects folder to sys.path in my wsgi script. This is my new wsgi script:

    activate_this = '/home/nimbiotics/.virtualenvs/nrpccms/bin/activate_this.py' execfile(activate_this, dict(file=activate_this))

    import os import sys

    path = '/home/nimbiotics/projects' if path not in sys.path: sys.path.append(path)

    ##################################################### nrpccms_path = '/home/nimbiotics/projects/nrpccms' if nrpccms_path not

    in sys.path: sys.path.append(nrpccms_path)

    #

    os.environ['DJANGO_SETTINGS_MODULE'] = 'nrpccms.settings'

    import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()