ImportError: No module named security

739 views
Skip to first unread message

Gary Roach

unread,
Jan 4, 2016, 8:56:51 PM1/4/16
to Django users
I've been trying different things with django and different tutorials. I
was using Ninja as my IDE but had to give it up because of lack of
support. I just switched to Eclipse with the PyDev plugin. (No I cant
get Pycharm). The IDE is complicated but seems to do everything I wish
it to do if I work at it long enough.

The problem:
I am working on Tango With Django tutorial and have a virtual
environment setup with Python 2.7 and Django 1.7 . Debian Linux is still
stuck with Eclipse 3.8 so I installed Eclipse Mars (4.5) from source.
The project properties show that python 2.7 is sourced from the virtual
environment's local/bin/ directory. Both Python 2.7 and Django 1.7 were
installed in the virtual environment using pip with the no site packages
switch. So everything should be walled off from the rest of the system.
Further, the project was working OK until I tried to access the /admin/
app. It hasn't worked since.

When I run debug on the project no errors show and the internal web
server starts fine. When I try to access either the rango/ app, the
admin/ app or just the 127.0.0.1:8000 basic url the browser shows "A
server error occurred. Please contact the administrator." The Eclipse
console shows the following:

Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File
"/home/gary/workspace/TangoWithDjango/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py",
line 64, in __call__
return self.application(environ, start_response)
File
"/home/gary/workspace/TangoWithDjango/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
line 168, in __call__
self.load_middleware()
File
"/home/gary/workspace/TangoWithDjango/local/lib/python2.7/site-packages/django/core/handlers/base.py",
line 44, in load_middleware
mw_class = import_string(middleware_path)
File
"/home/gary/workspace/TangoWithDjango/local/lib/python2.7/site-packages/django/utils/module_loading.py",
line 26, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in
import_module
__import__(name)
ImportError: No module named security
[05/Jan/2016 00:21:51] "GET / HTTP/1.1" 500 59

I notice that the first and last items on the traceback list are pulling
data from the global (system) python package. I've searched the net for
information. This problem shows up several times but It is obvious that
no one really understands what is causing it. I rebooted the system but
the problem persisted. Any help will be sincerely appreciated.

Gary R.



knbk

unread,
Jan 4, 2016, 9:29:09 PM1/4/16
to Django users, gary71...@verizon.net
Seems like you have SecurityMiddleware in your middleware settings, which wasn't added until 1.8. If you started your project on 1.8+. your default settings file would include the new middleware and cause this error on 1.7. 

Gary Roach

unread,
Jan 4, 2016, 10:03:28 PM1/4/16
to django-users
Dead On knbk. I commented out the security line and the problem when poof. Thank you.

Gary R.
Reply all
Reply to author
Forward
0 new messages