Answer the question
In order to leave comments, you need to log in
Djnago why error on startup?
New to django.
1) There are two versions of Python in the system. 2.6 and 2.7
2) Created an environment (virtualenvs) specifying the python version 2.7
3) the whole environment was successfully installed
4) added Djnago
Django.wsgi to the environment without any problems
#/usr/bin/python2.7
#coding: utf-8
import os
import sys
PROJECT_ROOT = os.path.dirname(__file__)
PYTHON_LIBS = '/home/adko/.virtualenvs/test/lib/python2.7/site-packages'
sys.path.extend((PROJECT_ROOT,PYTHON_LIBS,os.path.dirname(PROJECT_ROOT)))
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] mod_wsgi (pid=15554): Exception occurred processing WSGI script '/home/adko/projects/test/django.wsgi'.
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] Traceback (most recent call last):
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 250, in __call__
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] self.load_middleware()
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 51, in load_middleware
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] ImproperlyConfigured: Middleware module "django.contrib.auth.middleware" does not define a "SessionAuthenticationMiddleware" class
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] mod_wsgi (pid=15553): Exception occurred processing WSGI script '/home/adko/projects/test/django.wsgi'.
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] Traceback (most recent call last):
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 250, in __call__
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] self.load_middleware()
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 51, in load_middleware
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))
[Tue Aug 04 06:23:48 2015] [error] [client 172.20.1.68] ImproperlyConfigured: Middleware module "django.contrib.auth.middleware" does not define a "SessionAuthenticationMiddleware" class
Answer the question
In order to leave comments, you need to log in
2.6 it’s
not clear why you need to change wsgi.py - production is configured via nginx-uWSGI
development server starts./manage.py runserver
virtual environment is not activated, something is not configured correctly - djbook.ru/rel1.8/howto/deployment/wsgi/modwsgi.htm...
create a virtual environment with the desired version of python
virtualenv venv --no-site-packages --distribute -p /usr/bin/python2.7
and it will be there by default
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question