Forums

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

+++FIXED+++FIXED+++FIXED+++FIXED+++FIXED+++FIXED+++FIXED+++FIXED+++FIXED+++FIXED

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:

1
2
3
4
5
6
#! python
# ...
INSTALLED_APPS = (
    "nrpccms.newsroom",
    "django.contrib.admin",
# ...

Also, blog_extras.py is at MY_PROJECT/MY_APP/templates, and there IS a init.py at MY_PROJECT/mY_APP

Please help me pinpoint my mistakes as I don't know where else to look: This are my first baby steps in the arts of webapps/django

Thanks a lot in advanced!

Your Python path, or your DJANGO_SETTINGS_MODULE probably disagree, so you're trying to import settings from a place that doesn't exist.

Here is what I get from os.environ:

'http_proxy: http://proxy.server:3128'
'LC_CTYPE: en_US.utf-8'
'LOGNAME: nimbiotics'
'USER: nimbiotics'
'PATH: /home/nimbiotics/.virtualenvs/nrpccms/bin:/home/nimbiotics/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
'HOME: /home/nimbiotics'
'PS1: (nrpccms)\\[\\033[0;37m\\]$(date +%H:%M) \\w\\[\\033[0;33m\\] $(parse_git_branch)\\[\\033[1;32m\\]$ \\[\\033[0;37m\\]'
'TERM: linux'
'TZ: America/New_York'
'SHLVL: 1'
'https_proxy: http://proxy.server:3128'
'SUDO_USER: root'
'USERNAME: nimbiotics'
'WORKON_HOME: /home/nimbiotics/.virtualenvs'
'SUDO_COMMAND: /bin/bash -c cd .;cd . ; cd /home/nimbiotics; exec bash '
'SUDO_UID: 0'
'VIRTUAL_ENV: /home/nimbiotics/.virtualenvs/nrpccms'
'PYENCHANT_LIBRARY_PATH: /usr/lib/libenchant.so.1'
'_: ./manage.py'
'VIRTUALENVWRAPPER_PROJECT_FILENAME: .project'
'SUDO_GID: 0'
'VIRTUALENVWRAPPER_HOOK_DIR: /home/nimbiotics/.virtualenvs'
'PYTHONSTARTUP: /home/nimbiotics/.pythonstartup.py'
'OLDPWD: /home/nimbiotics'
'HISTCONTROL: ignoreboth'
'no_proxy: localhost,127.0.0.1,localaddress,.localdomain.com'
'PWD: /home/nimbiotics/projects/nrpccms'
'DJANGO_SETTINGS_MODULE: nrpccms.settings'

I can only guess DJANGO_SETTINGS_MODULE is what is supposed to. am I wrong?

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()