Forums

Django Error: Error importing middleware django.middleware.clickjacking: "No module named clickjacking"

Hello,

I´m trying to deploy my django 1.6.4 project on a virtual enviroment using python anywhere.

However I´m getting a 404 when I check the site with this error:

django.core.exceptions.ImproperlyConfigured: Error importing middleware django.middleware.clickjacking: "No module named clickjacking"

This is my wsgi.py

# +++++++++++ CUSTOM WSGI +++++++++++
# If you have a WSGI file that you want to serve using PythonAnywhere, perhaps
# in your home directory under version control, then use something like this:
#
#import os
#import sys
#
#path = '/home/pjestrada/path/to/my/app
#if path not in sys.path:
#    sys.path.append(path)
##from my_wsgi_file import application


# +++++++++++ DJANGO +++++++++++

# TURN ON THE VIRTUAL ENVIRONMENT FOR YOUR APPLICATION
activate_this = '/home/pjestrada/.virtualenvs/rango/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

# To use your own django app use code like this:
import os
import sys
#

path = '/home/pjestrada/rango/tango_with_django_project'

if path not in sys.path:
    sys.path.append(path)

os.chdir(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'tango_with_django_project.settings'
#
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Have you reloaded the web app since you installed the virtualenv?

Yes I already reloaded it. I also found that now I´m getting this error:

2014-06-17 17:56:22,529 :ImportError: Could not import settings 'tango_with_django_project.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named tango_with_django_project.settings

My tree:

.
├── Dropbox
   ├── README.txt
   └── __init__.py
├── README.txt
└── rango
    ├── LICENSE
    ├── README.md
    └── tango_with_django_project
        ├── manage.py
        ├── media
           ├── profile_images
              └── 10411981_634016890008979_1609187547738555774_n.jpg
           └── rango2.jpg
        ├── populate_rango.py
        ├── rango
               ├── __init__.py
           ├── __init__.pyc
           ├── admin.py
           ├── admin.pyc
           ├── bing_search.py
           ├── bing_search.pyc
           ├── forms.py
           ├── forms.pyc
           ├── models.py
           ├── models.pyc
           ├── tests.py
           ├── urls.py
           ├── urls.pyc 
           ├── views.py
           └── views.pyc
        ├── static
           ├── about.jpg 
           ├── css
              ├── bootstrap-fluid-adj.css
              ├── bootstrap-responsive.css
              ├── bootstrap-responsive.min.css
              ├── bootstrap.css
              └── bootstrap.min.css
           ├── img
              ├── glyphicons-halflings-white.png
              └── glyphicons-halflings.png
           ├── js
              ├── bootstrap.js
              ├── bootstrap.min.js
              ├── jquery-2.1.1.js
              └── rango-ajax.js
           └── rango.jpg
        ├── tango_with_django_project
           ├── __init__.py
           ├── __init__.pyc
           ├── settings.py
           ├── settings.pyc
           ├── urls.py
           ├── urls.pyc
           └── wsgi.py
        └── templates
            └── rango
                ├── about.html
                ├── add_category.html
                ├── add_page.html
                ├── base.html
                ├── category.html
                ├── category_list.html
                ├── index.html
                ├── login.html
                ├── page_list.html
                ├── profile.html
                ├── register.html
                ├── restricted.html
                └── search.html

Your site seems to be up now. Did you manage to find what the problem was?

Incidentally, I wrote a wiki page on sys.path and import issues, it may be of use?

https://www.pythonanywhere.com/wiki/DebuggingImportError