Error with importing module named middleware
After transfering a django project(working) from one server to another, when trying to run the application on the new server I face up the error:
Django version 1.11.16, using settings 'geolocator.settings'
Starting development server at http://example.example.com:2000/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function wrapper at 0x7f23d7ab3668>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 146, in inner_run
handler = self.get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/runserver.py", line 28, in get_handler
handler = super(Command, self).get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 67, in get_handler
return get_internal_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 44, in get_internal_wsgi_application
return get_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
return WSGIHandler()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 20, 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 middleware
In settings.py :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'intranet',
'bootstrap3',
'registration',
'crispy_forms',
'fm',
'dal',
'dal_select2',
'rest_framework',
'django_filters',
'django_crontab',
'request',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
It seems having to do with WSGI but I am not sure what exactly goes wrong.
Any suggestion?
django settings middleware
add a comment |
After transfering a django project(working) from one server to another, when trying to run the application on the new server I face up the error:
Django version 1.11.16, using settings 'geolocator.settings'
Starting development server at http://example.example.com:2000/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function wrapper at 0x7f23d7ab3668>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 146, in inner_run
handler = self.get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/runserver.py", line 28, in get_handler
handler = super(Command, self).get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 67, in get_handler
return get_internal_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 44, in get_internal_wsgi_application
return get_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
return WSGIHandler()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 20, 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 middleware
In settings.py :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'intranet',
'bootstrap3',
'registration',
'crispy_forms',
'fm',
'dal',
'dal_select2',
'rest_framework',
'django_filters',
'django_crontab',
'request',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
It seems having to do with WSGI but I am not sure what exactly goes wrong.
Any suggestion?
django settings middleware
No, it has nothing to do with WSGI. Have you tried commenting out each item in the MIDDLEWARE list in turn, to see which one is causing the problem? And are you sure you are using the same version of Django as on the original server?
– Daniel Roseman
Nov 12 '18 at 13:50
@DanielRoseman the items are ok and the python version is the same. The django version is different. The old one(working) is 1.10.1 and the new is 1.11.16. Seems that is the issue?
– gtopal
Nov 12 '18 at 14:24
I don't know what you mean by "the items are OK". Which entry is causing the problem?
– Daniel Roseman
Nov 12 '18 at 14:47
none of the items of the list.
– gtopal
Nov 12 '18 at 14:56
add a comment |
After transfering a django project(working) from one server to another, when trying to run the application on the new server I face up the error:
Django version 1.11.16, using settings 'geolocator.settings'
Starting development server at http://example.example.com:2000/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function wrapper at 0x7f23d7ab3668>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 146, in inner_run
handler = self.get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/runserver.py", line 28, in get_handler
handler = super(Command, self).get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 67, in get_handler
return get_internal_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 44, in get_internal_wsgi_application
return get_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
return WSGIHandler()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 20, 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 middleware
In settings.py :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'intranet',
'bootstrap3',
'registration',
'crispy_forms',
'fm',
'dal',
'dal_select2',
'rest_framework',
'django_filters',
'django_crontab',
'request',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
It seems having to do with WSGI but I am not sure what exactly goes wrong.
Any suggestion?
django settings middleware
After transfering a django project(working) from one server to another, when trying to run the application on the new server I face up the error:
Django version 1.11.16, using settings 'geolocator.settings'
Starting development server at http://example.example.com:2000/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function wrapper at 0x7f23d7ab3668>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 146, in inner_run
handler = self.get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/runserver.py", line 28, in get_handler
handler = super(Command, self).get_handler(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 67, in get_handler
return get_internal_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 44, in get_internal_wsgi_application
return get_wsgi_application()
File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
return WSGIHandler()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 20, 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 middleware
In settings.py :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'intranet',
'bootstrap3',
'registration',
'crispy_forms',
'fm',
'dal',
'dal_select2',
'rest_framework',
'django_filters',
'django_crontab',
'request',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
It seems having to do with WSGI but I am not sure what exactly goes wrong.
Any suggestion?
django settings middleware
django settings middleware
asked Nov 12 '18 at 13:48
gtopalgtopal
309
309
No, it has nothing to do with WSGI. Have you tried commenting out each item in the MIDDLEWARE list in turn, to see which one is causing the problem? And are you sure you are using the same version of Django as on the original server?
– Daniel Roseman
Nov 12 '18 at 13:50
@DanielRoseman the items are ok and the python version is the same. The django version is different. The old one(working) is 1.10.1 and the new is 1.11.16. Seems that is the issue?
– gtopal
Nov 12 '18 at 14:24
I don't know what you mean by "the items are OK". Which entry is causing the problem?
– Daniel Roseman
Nov 12 '18 at 14:47
none of the items of the list.
– gtopal
Nov 12 '18 at 14:56
add a comment |
No, it has nothing to do with WSGI. Have you tried commenting out each item in the MIDDLEWARE list in turn, to see which one is causing the problem? And are you sure you are using the same version of Django as on the original server?
– Daniel Roseman
Nov 12 '18 at 13:50
@DanielRoseman the items are ok and the python version is the same. The django version is different. The old one(working) is 1.10.1 and the new is 1.11.16. Seems that is the issue?
– gtopal
Nov 12 '18 at 14:24
I don't know what you mean by "the items are OK". Which entry is causing the problem?
– Daniel Roseman
Nov 12 '18 at 14:47
none of the items of the list.
– gtopal
Nov 12 '18 at 14:56
No, it has nothing to do with WSGI. Have you tried commenting out each item in the MIDDLEWARE list in turn, to see which one is causing the problem? And are you sure you are using the same version of Django as on the original server?
– Daniel Roseman
Nov 12 '18 at 13:50
No, it has nothing to do with WSGI. Have you tried commenting out each item in the MIDDLEWARE list in turn, to see which one is causing the problem? And are you sure you are using the same version of Django as on the original server?
– Daniel Roseman
Nov 12 '18 at 13:50
@DanielRoseman the items are ok and the python version is the same. The django version is different. The old one(working) is 1.10.1 and the new is 1.11.16. Seems that is the issue?
– gtopal
Nov 12 '18 at 14:24
@DanielRoseman the items are ok and the python version is the same. The django version is different. The old one(working) is 1.10.1 and the new is 1.11.16. Seems that is the issue?
– gtopal
Nov 12 '18 at 14:24
I don't know what you mean by "the items are OK". Which entry is causing the problem?
– Daniel Roseman
Nov 12 '18 at 14:47
I don't know what you mean by "the items are OK". Which entry is causing the problem?
– Daniel Roseman
Nov 12 '18 at 14:47
none of the items of the list.
– gtopal
Nov 12 '18 at 14:56
none of the items of the list.
– gtopal
Nov 12 '18 at 14:56
add a comment |
1 Answer
1
active
oldest
votes
I went to https://docs.djangoproject.com/en/1.11/topics/http/middleware/#activating-middleware to find the official list of middlewares.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware', # <-- Remove this one.
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
request.middleware.RequestMiddleware
is not supported in Django 1.11.16.
that works for me!
– gtopal
Nov 13 '18 at 7:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263552%2ferror-with-importing-module-named-middleware%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I went to https://docs.djangoproject.com/en/1.11/topics/http/middleware/#activating-middleware to find the official list of middlewares.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware', # <-- Remove this one.
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
request.middleware.RequestMiddleware
is not supported in Django 1.11.16.
that works for me!
– gtopal
Nov 13 '18 at 7:24
add a comment |
I went to https://docs.djangoproject.com/en/1.11/topics/http/middleware/#activating-middleware to find the official list of middlewares.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware', # <-- Remove this one.
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
request.middleware.RequestMiddleware
is not supported in Django 1.11.16.
that works for me!
– gtopal
Nov 13 '18 at 7:24
add a comment |
I went to https://docs.djangoproject.com/en/1.11/topics/http/middleware/#activating-middleware to find the official list of middlewares.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware', # <-- Remove this one.
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
request.middleware.RequestMiddleware
is not supported in Django 1.11.16.
I went to https://docs.djangoproject.com/en/1.11/topics/http/middleware/#activating-middleware to find the official list of middlewares.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'request.middleware.RequestMiddleware', # <-- Remove this one.
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
request.middleware.RequestMiddleware
is not supported in Django 1.11.16.
answered Nov 12 '18 at 15:03
jerrymousejerrymouse
8,505104867
8,505104867
that works for me!
– gtopal
Nov 13 '18 at 7:24
add a comment |
that works for me!
– gtopal
Nov 13 '18 at 7:24
that works for me!
– gtopal
Nov 13 '18 at 7:24
that works for me!
– gtopal
Nov 13 '18 at 7:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263552%2ferror-with-importing-module-named-middleware%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
No, it has nothing to do with WSGI. Have you tried commenting out each item in the MIDDLEWARE list in turn, to see which one is causing the problem? And are you sure you are using the same version of Django as on the original server?
– Daniel Roseman
Nov 12 '18 at 13:50
@DanielRoseman the items are ok and the python version is the same. The django version is different. The old one(working) is 1.10.1 and the new is 1.11.16. Seems that is the issue?
– gtopal
Nov 12 '18 at 14:24
I don't know what you mean by "the items are OK". Which entry is causing the problem?
– Daniel Roseman
Nov 12 '18 at 14:47
none of the items of the list.
– gtopal
Nov 12 '18 at 14:56