Hi everyone, I'm new to Django, so please forgive my ignorance.... I'm trying to follow the tutorial, but I seem to have done something wrong. When running the "Hello world app", here's what I got as an error log:
2016-02-18 06:44:57,494 :Traceback (most recent call last):
2016-02-18 06:44:57,494 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:44:57,504 : module = import_module(module_path)
2016-02-18 06:44:57,504 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:44:57,505 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:44:57,505 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:44:57,506 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:44:57,506 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:44:57,506 :ImportError: No module named 'django.middleware.security'
2016-02-18 06:44:57,507 :
2016-02-18 06:44:57,507 :During handling of the above exception, another exception occurred:
2016-02-18 06:44:57,507 :
2016-02-18 06:44:57,507 :Traceback (most recent call last):
2016-02-18 06:44:57,507 : File "/bin/user_wsgi_wrapper.py", line 134, in __call__
2016-02-18 06:44:57,507 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-18 06:44:57,507 : File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-02-18 06:44:57,524 : self.error(msg, *args, **kwargs)
2016-02-18 06:44:57,524 : File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-02-18 06:44:57,525 : self._log(ERROR, msg, args, **kwargs)
2016-02-18 06:44:57,525 : File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-02-18 06:44:57,526 : self.handle(record)
2016-02-18 06:44:57,526 : File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-02-18 06:44:57,526 : if (not self.disabled) and self.filter(record):
2016-02-18 06:44:57,526 : File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-02-18 06:44:57,527 : for f in self.filters:
2016-02-18 06:44:57,527 : File "/bin/user_wsgi_wrapper.py", line 126, in __call__
2016-02-18 06:44:57,527 : app_iterator = self.app(environ, start_response)
2016-02-18 06:44:57,527 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2016-02-18 06:44:57,528 : self.load_middleware()
2016-02-18 06:44:57,528 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
2016-02-18 06:44:57,529 : mw_class = import_by_path(middleware_path)
2016-02-18 06:44:57,529 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
2016-02-18 06:44:57,529 : sys.exc_info()[2])
2016-02-18 06:44:57,530 : File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 549, in reraise
2016-02-18 06:44:57,532 : raise value.with_traceback(tb)
2016-02-18 06:44:57,532 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:44:57,532 : module = import_module(module_path)
2016-02-18 06:44:57,532 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:44:57,532 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:44:57,532 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:44:57,533 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:44:57,533 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:44:57,533 :django.core.exceptions.ImproperlyConfigured: Error importing module django.middleware.security: "No module named 'django.middleware.security'"
2016-02-18 06:45:28,893 :Traceback (most recent call last):
2016-02-18 06:45:28,916 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:45:28,917 : module = import_module(module_path)
2016-02-18 06:45:28,917 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:45:28,917 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:45:28,917 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:45:28,917 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:45:28,918 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:45:28,918 :ImportError: No module named 'django.middleware.security'
2016-02-18 06:45:28,918 :
2016-02-18 06:45:28,918 :During handling of the above exception, another exception occurred:
2016-02-18 06:45:28,918 :
2016-02-18 06:45:28,918 :Traceback (most recent call last):
2016-02-18 06:45:28,918 : File "/bin/user_wsgi_wrapper.py", line 134, in __call__
2016-02-18 06:45:28,918 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-18 06:45:28,919 : File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-02-18 06:45:28,919 : self.error(msg, *args, **kwargs)
2016-02-18 06:45:28,919 : File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-02-18 06:45:28,920 : self._log(ERROR, msg, args, **kwargs)
2016-02-18 06:45:28,920 : File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-02-18 06:45:28,921 : self.handle(record)
2016-02-18 06:45:28,921 : File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-02-18 06:45:28,921 : if (not self.disabled) and self.filter(record):
2016-02-18 06:45:28,921 : File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-02-18 06:45:28,922 : for f in self.filters:
2016-02-18 06:45:28,922 : File "/bin/user_wsgi_wrapper.py", line 126, in __call__
2016-02-18 06:45:28,922 : app_iterator = self.app(environ, start_response)
2016-02-18 06:45:28,922 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2016-02-18 06:45:28,923 : self.load_middleware()
2016-02-18 06:45:28,923 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
2016-02-18 06:45:28,923 : mw_class = import_by_path(middleware_path)
2016-02-18 06:45:28,923 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
2016-02-18 06:45:28,923 : sys.exc_info()[2])
2016-02-18 06:45:28,923 : File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 549, in reraise
2016-02-18 06:45:28,924 : raise value.with_traceback(tb)
2016-02-18 06:45:28,924 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:45:28,924 : module = import_module(module_path)
2016-02-18 06:45:28,924 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:45:28,924 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:45:28,924 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:45:28,924 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:45:28,925 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:45:28,925 :django.core.exceptions.ImproperlyConfigured: Error importing module django.middleware.security: "No module named 'django.middleware.security'"
2016-02-18 06:45:30,000 :Traceback (most recent call last):
2016-02-18 06:45:30,001 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:45:30,001 : module = import_module(module_path)
2016-02-18 06:45:30,001 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:45:30,002 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:45:30,002 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:45:30,002 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:45:30,002 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:45:30,002 :ImportError: No module named 'django.middleware.security'
2016-02-18 06:45:30,002 :
2016-02-18 06:45:30,002 :During handling of the above exception, another exception occurred:
2016-02-18 06:45:30,003 :
2016-02-18 06:45:30,003 :Traceback (most recent call last):
2016-02-18 06:45:30,003 : File "/bin/user_wsgi_wrapper.py", line 134, in __call__
2016-02-18 06:45:30,003 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-18 06:45:30,003 : File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-02-18 06:45:30,004 : self.error(msg, *args, **kwargs)
2016-02-18 06:45:30,004 : File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-02-18 06:45:30,005 : self._log(ERROR, msg, args, **kwargs)
2016-02-18 06:45:30,005 : File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-02-18 06:45:30,006 : self.handle(record)
2016-02-18 06:45:30,006 : File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-02-18 06:45:30,006 : if (not self.disabled) and self.filter(record):
2016-02-18 06:45:30,006 : File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-02-18 06:45:30,007 : for f in self.filters:
2016-02-18 06:45:30,007 : File "/bin/user_wsgi_wrapper.py", line 126, in __call__
2016-02-18 06:45:30,007 : app_iterator = self.app(environ, start_response)
2016-02-18 06:45:30,007 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2016-02-18 06:45:30,008 : self.load_middleware()
2016-02-18 06:45:30,008 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
2016-02-18 06:45:30,008 : mw_class = import_by_path(middleware_path)
2016-02-18 06:45:30,008 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
2016-02-18 06:45:30,008 : sys.exc_info()[2])
2016-02-18 06:45:30,008 : File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 549, in reraise
2016-02-18 06:45:30,009 : raise value.with_traceback(tb)
2016-02-18 06:45:30,009 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:45:30,009 : module = import_module(module_path)
2016-02-18 06:45:30,009 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:45:30,009 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:45:30,009 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:45:30,009 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:45:30,010 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:45:30,010 :django.core.exceptions.ImproperlyConfigured: Error importing module django.middleware.security: "No module named 'django.middleware.security'"
2016-02-18 06:51:49,768 :Traceback (most recent call last):
2016-02-18 06:51:49,768 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:51:49,769 : module = import_module(module_path)
2016-02-18 06:51:49,769 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:51:49,769 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:51:49,769 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:51:49,769 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:51:49,769 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:51:49,770 :ImportError: No module named 'django.middleware.security'
2016-02-18 06:51:49,770 :
2016-02-18 06:51:49,770 :During handling of the above exception, another exception occurred:
2016-02-18 06:51:49,770 :
2016-02-18 06:51:49,770 :Traceback (most recent call last):
2016-02-18 06:51:49,770 : File "/bin/user_wsgi_wrapper.py", line 134, in __call__
2016-02-18 06:51:49,770 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-18 06:51:49,770 : File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-02-18 06:51:49,771 : self.error(msg, *args, **kwargs)
2016-02-18 06:51:49,771 : File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-02-18 06:51:49,772 : self._log(ERROR, msg, args, **kwargs)
2016-02-18 06:51:49,772 : File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-02-18 06:51:49,772 : self.handle(record)
2016-02-18 06:51:49,772 : File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-02-18 06:51:49,773 : if (not self.disabled) and self.filter(record):
2016-02-18 06:51:49,773 : File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-02-18 06:51:49,773 : for f in self.filters:
2016-02-18 06:51:49,773 : File "/bin/user_wsgi_wrapper.py", line 126, in __call__
2016-02-18 06:51:49,774 : app_iterator = self.app(environ, start_response)
2016-02-18 06:51:49,774 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2016-02-18 06:51:49,774 : self.load_middleware()
2016-02-18 06:51:49,774 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
2016-02-18 06:51:49,774 : mw_class = import_by_path(middleware_path)
2016-02-18 06:51:49,774 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
2016-02-18 06:51:49,774 : sys.exc_info()[2])
2016-02-18 06:51:49,775 : File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 549, in reraise
2016-02-18 06:51:49,775 : raise value.with_traceback(tb)
2016-02-18 06:51:49,775 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:51:49,775 : module = import_module(module_path)
2016-02-18 06:51:49,775 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:51:49,775 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:51:49,775 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:51:49,776 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:51:49,776 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:51:49,776 :django.core.exceptions.ImproperlyConfigured: Error importing module django.middleware.security: "No module named 'django.middleware.security'"
2016-02-18 06:52:02,621 :Traceback (most recent call last):
2016-02-18 06:52:02,621 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:52:02,622 : module = import_module(module_path)
2016-02-18 06:52:02,622 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:52:02,622 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:52:02,622 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:52:02,622 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:52:02,623 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:52:02,623 :ImportError: No module named 'django.middleware.security'
2016-02-18 06:52:02,623 :
2016-02-18 06:52:02,623 :During handling of the above exception, another exception occurred:
2016-02-18 06:52:02,623 :
2016-02-18 06:52:02,623 :Traceback (most recent call last):
2016-02-18 06:52:02,623 : File "/bin/user_wsgi_wrapper.py", line 134, in __call__
2016-02-18 06:52:02,623 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-18 06:52:02,623 : File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-02-18 06:52:02,624 : self.error(msg, *args, **kwargs)
2016-02-18 06:52:02,624 : File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-02-18 06:52:02,625 : self._log(ERROR, msg, args, **kwargs)
2016-02-18 06:52:02,625 : File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-02-18 06:52:02,625 : self.handle(record)
2016-02-18 06:52:02,625 : File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-02-18 06:52:02,626 : if (not self.disabled) and self.filter(record):
2016-02-18 06:52:02,626 : File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-02-18 06:52:02,626 : for f in self.filters:
2016-02-18 06:52:02,626 : File "/bin/user_wsgi_wrapper.py", line 126, in __call__
2016-02-18 06:52:02,627 : app_iterator = self.app(environ, start_response)
2016-02-18 06:52:02,627 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2016-02-18 06:52:02,627 : self.load_middleware()
2016-02-18 06:52:02,627 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
2016-02-18 06:52:02,627 : mw_class = import_by_path(middleware_path)
2016-02-18 06:52:02,627 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
2016-02-18 06:52:02,627 : sys.exc_info()[2])
2016-02-18 06:52:02,627 : File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 549, in reraise
2016-02-18 06:52:02,628 : raise value.with_traceback(tb)
2016-02-18 06:52:02,628 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:52:02,628 : module = import_module(module_path)
2016-02-18 06:52:02,628 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:52:02,628 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:52:02,628 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:52:02,629 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:52:02,629 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:52:02,629 :django.core.exceptions.ImproperlyConfigured: Error importing module django.middleware.security: "No module named 'django.middleware.security'"
2016-02-18 06:52:08,954 :Traceback (most recent call last):
2016-02-18 06:52:08,955 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:52:08,955 : module = import_module(module_path)
2016-02-18 06:52:08,955 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:52:08,956 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:52:08,956 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:52:08,956 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:52:08,956 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:52:08,957 :ImportError: No module named 'django.middleware.security'
2016-02-18 06:52:08,957 :
2016-02-18 06:52:08,957 :During handling of the above exception, another exception occurred:
2016-02-18 06:52:08,957 :
2016-02-18 06:52:08,957 :Traceback (most recent call last):
2016-02-18 06:52:08,957 : File "/bin/user_wsgi_wrapper.py", line 134, in __call__
2016-02-18 06:52:08,957 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-18 06:52:08,957 : File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-02-18 06:52:08,958 : self.error(msg, *args, **kwargs)
2016-02-18 06:52:08,958 : File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-02-18 06:52:08,959 : self._log(ERROR, msg, args, **kwargs)
2016-02-18 06:52:08,959 : File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-02-18 06:52:08,960 : self.handle(record)
2016-02-18 06:52:08,960 : File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-02-18 06:52:08,960 : if (not self.disabled) and self.filter(record):
2016-02-18 06:52:08,960 : File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-02-18 06:52:08,961 : for f in self.filters:
2016-02-18 06:52:08,961 : File "/bin/user_wsgi_wrapper.py", line 126, in __call__
2016-02-18 06:52:08,961 : app_iterator = self.app(environ, start_response)
2016-02-18 06:52:08,962 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2016-02-18 06:52:08,962 : self.load_middleware()
2016-02-18 06:52:08,962 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
2016-02-18 06:52:08,963 : mw_class = import_by_path(middleware_path)
2016-02-18 06:52:08,963 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
2016-02-18 06:52:08,963 : sys.exc_info()[2])
2016-02-18 06:52:08,963 : File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 549, in reraise
2016-02-18 06:52:08,964 : raise value.with_traceback(tb)
2016-02-18 06:52:08,964 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:52:08,964 : module = import_module(module_path)
2016-02-18 06:52:08,965 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:52:08,965 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:52:08,965 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:52:08,965 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:52:08,966 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:52:08,966 :django.core.exceptions.ImproperlyConfigured: Error importing module django.middleware.security: "No module named 'django.middleware.security'"
2016-02-18 06:52:09,156 :Traceback (most recent call last):
2016-02-18 06:52:09,156 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:52:09,157 : module = import_module(module_path)
2016-02-18 06:52:09,157 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:52:09,157 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:52:09,157 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:52:09,157 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:52:09,158 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:52:09,158 :ImportError: No module named 'django.middleware.security'
2016-02-18 06:52:09,158 :
2016-02-18 06:52:09,158 :During handling of the above exception, another exception occurred:
2016-02-18 06:52:09,158 :
2016-02-18 06:52:09,158 :Traceback (most recent call last):
2016-02-18 06:52:09,158 : File "/bin/user_wsgi_wrapper.py", line 134, in __call__
2016-02-18 06:52:09,158 : self.error_log_file.logger.exception("Error running WSGI application")
2016-02-18 06:52:09,159 : File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-02-18 06:52:09,159 : self.error(msg, *args, **kwargs)
2016-02-18 06:52:09,159 : File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-02-18 06:52:09,160 : self._log(ERROR, msg, args, **kwargs)
2016-02-18 06:52:09,160 : File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-02-18 06:52:09,161 : self.handle(record)
2016-02-18 06:52:09,161 : File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-02-18 06:52:09,162 : if (not self.disabled) and self.filter(record):
2016-02-18 06:52:09,162 : File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-02-18 06:52:09,164 : for f in self.filters:
2016-02-18 06:52:09,164 : File "/bin/user_wsgi_wrapper.py", line 126, in __call__
2016-02-18 06:52:09,164 : app_iterator = self.app(environ, start_response)
2016-02-18 06:52:09,164 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
2016-02-18 06:52:09,165 : self.load_middleware()
2016-02-18 06:52:09,165 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
2016-02-18 06:52:09,165 : mw_class = import_by_path(middleware_path)
2016-02-18 06:52:09,165 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
2016-02-18 06:52:09,165 : sys.exc_info()[2])
2016-02-18 06:52:09,166 : File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 549, in reraise
2016-02-18 06:52:09,166 : raise value.with_traceback(tb)
2016-02-18 06:52:09,166 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
2016-02-18 06:52:09,166 : module = import_module(module_path)
2016-02-18 06:52:09,166 : File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
2016-02-18 06:52:09,167 : return _bootstrap._gcd_import(name[level:], package, level)
2016-02-18 06:52:09,167 : File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
2016-02-18 06:52:09,167 : File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
2016-02-18 06:52:09,167 : File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
2016-02-18 06:52:09,167 :django.core.exceptions.ImproperlyConfigured: Error importing module django.middleware.security: "No module named 'django.middleware.security'"
So, I followed the debugging instructions (I'm using a virualenv called django17):
07:24 ~/mysite $ workon django17
(django17) 07:24 ~/mysite $ python -i /var/www/karrot_pythonanywhere_com_wsgi.py
no error messages so far..... So, I went on and tried the import that shows the error in the error log file:
(django17) 07:24 ~/mysite $ python -i /var/www/karrot_pythonanywhere_com_wsgi.py
>>> import django.middleware.security
>>>
or...
>>> from django.core.wsgi import get_wsgi_application
>>>
looks fine.... I checked the python version:
(django17) 07:39 ~/mysite $ python --version
Python 3.4.3
When checking in the web tab, Python version is 3.4.
What's wrong the?
here's my wsgi file:
# This file contains the WSGI configuration required to serve up your
# web application at http://karrot.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# +++++++++++ GENERAL DEBUGGING TIPS +++++++++++
# getting imports and sys.path right can be fiddly!
# We've tried to collect some general tips here:
# https://www.pythonanywhere.com/wiki/DebuggingImportError
# +++++++++++ HELLO WORLD +++++++++++
# A little pure-wsgi hello world we've cooked up, just
# to prove everything works. You should delete this
# code to get your own working.
HELLO_WORLD = """<html>
<head>
<title>Python Anywhere hosted web application</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>
This is the default welcome page for a
<a href="https://www.pythonanywhere.com/">PythonAnywhere</a>
hosted web application.
</p>
<p>
Find out more about how to configure your own web application
by visiting the <a href="https://www.pythonanywhere.com/web_app_setup/">web app setup</a> page
</p>
</body>
</html>"""
def application(environ, start_response):
if environ.get('PATH_INFO') == '/':
status = '200 OK'
content = HELLO_WORLD
else:
status = '404 NOT FOUND'
content = 'Page not found.'
response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))]
start_response(status, response_headers)
yield content.encode('utf8')
# Below are templates for Django and Flask. You should update the file
# appropriately for the web framework you're using, and then
# click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site
# live.
# +++++++++++ VIRTUALENV +++++++++++
# If you want to use a virtualenv, set its path on the web app setup tab.
# Then come back here and import your application object as per the
# instructions below
# +++++++++++ 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 sys
#
#path = '/home/karrot/path/to/my/app
#if path not in sys.path:
# sys.path.append(path)
#
#from my_wsgi_file import application
# +++++++++++ DJANGO +++++++++++
# To use your own django app use code like this:
import os
import sys
# assuming your django settings file is at '/home/karrot/mysite/mysite/settings.py'
# and your manage.py is is at '/home/karrot/mysite/manage.py'
path = '/home/karrot/mysite'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
# then, for django >=1.5:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
## or, for older django <=1.4
#import django.core.handlers.wsgi
#application = django.core.handlers.wsgi.WSGIHandler()
# +++++++++++ FLASK +++++++++++
# Flask works like any other WSGI-compatible framework, we just need
# to import the application. Often Flask apps are called "app" so we
# may need to rename it during the import:
#
#
#import sys
#
## The "/home/karrot" below specifies your home
## directory -- the rest should be the directory you uploaded your Flask
## code to underneath the home directory. So if you just ran
## "git clone git@github.com/myusername/myproject.git"
## ...or uploaded files to the directory "myproject", then you should
## specify "/home/karrot/myproject"
#path = '/home/karrot/path/to/flask_app_directory'
#if path not in sys.path:
# sys.path.append(path)
#
## After you uncomment the line below, the yellow triangle on the left
## side in our in-browser editor shows a warning saying:
## 'application' imported but unused.
## You can ignore this error. The line is necessary, and the variable
## is used externally.
#from main_flask_app_file import app as application
#
# NB -- many Flask guides suggest you use a file called run.py; that's
# not necessary on PythonAnywhere. And you should make sure your code
# does *not* invoke the flask development server with app.run(), as it
# will prevent your wsgi file from working.
Thanks in advance and have a nice day! JT