500 Internal Server Error - Misconfigured Website - django

I am uploading a website to a Ubuntu 14.04 VPS for the first time. I am using Apache 2.4.7, mod_wsgi, and Django 1.8.5. I am getting a 500 Internal Server Error. I cannot figure out if the problem is in my wsgi file or configuration or my Django configuration.
Apache Error Log:
[Tue Dec 15 19:57:14.734974 2015] [mpm_event:notice] [pid 28996:tid 139939323643776] AH00491: caught SIGTERM, shutting down
[Tue Dec 15 19:57:15.751172 2015] [mpm_event:notice] [pid 29181:tid 139688285566848] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Tue Dec 15 19:57:15.751270 2015] [core:notice] [pid 29181:tid 139688285566848] AH00094: Command line: '/usr/sbin/apache2'
[Tue Dec 15 19:57:19.996550 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] mod_wsgi (pid=29185): Exception occurred processing WSGI script '/var/www/MYSITE/MYSITE/wsgi.py'.
[Tue Dec 15 19:57:19.996694 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] Traceback (most recent call last):
[Tue Dec 15 19:57:19.996935 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Tue Dec 15 19:57:19.997146 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] self.load_middleware()
[Tue Dec 15 19:57:19.997163 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Tue Dec 15 19:57:19.997291 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] mw_class = import_by_path(middleware_path)
[Tue Dec 15 19:57:19.997305 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
[Tue Dec 15 19:57:19.997361 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] sys.exc_info()[2])
[Tue Dec 15 19:57:19.997371 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
[Tue Dec 15 19:57:19.997384 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] module = import_module(module_path)
[Tue Dec 15 19:57:19.997389 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
[Tue Dec 15 19:57:19.997425 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] __import__(name)
[Tue Dec 15 19:57:19.997447 2015] [:error] [pid 29185:tid 139688073475840] [client 107.143.109.119:50975] ImproperlyConfigured: Error importing module django.middleware.security: "No module named security"
[Tue Dec 15 19:57:20.201372 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] mod_wsgi (pid=29184): Exception occurred processing WSGI script '/var/www/MYSITE/MYSITE/wsgi.py'., referer: http://MY_IP/
[Tue Dec 15 19:57:20.201446 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] Traceback (most recent call last):, referer: http://MY_IP/
[Tue Dec 15 19:57:20.201468 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__, referer: http://MY_IP/
[Tue Dec 15 19:57:20.201575 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] self.load_middleware(), referer: http://MY_IP/
[Tue Dec 15 19:57:20.201587 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware, referer: http://MY_IP/
[Tue Dec 15 19:57:20.201699 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] mw_class = import_by_path(middleware_path), referer: http://MY_IP/
[Tue Dec 15 19:57:20.201713 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 26, in import_by_path, referer: http://MY_IP/
[Tue Dec 15 19:57:20.201765 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] sys.exc_info()[2]), referer: http://MY_IP/
[Tue Dec 15 19:57:20.201775 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 21, in import_by_path, referer: http://MY_IP/
[Tue Dec 15 19:57:20.201798 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] module = import_module(module_path), referer: http://MY_IP/
[Tue Dec 15 19:57:20.201806 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module, referer: http://MY_IP/
[Tue Dec 15 19:57:20.201845 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] __import__(name), referer: http://MY_IP/
[Tue Dec 15 19:57:20.201869 2015] [:error] [pid 29184:tid 139688190367488] [client 107.143.109.119:50976] ImproperlyConfigured: Error importing module django.middleware.security: "No module named security", referer: http://MY_IP/
[Tue Dec 15 19:57:22.650853 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] mod_wsgi (pid=29184): Exception occurred processing WSGI script '/var/www/MYSITE/MYSITE/wsgi.py'.
[Tue Dec 15 19:57:22.650936 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] Traceback (most recent call last):
[Tue Dec 15 19:57:22.650987 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Tue Dec 15 19:57:22.651044 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] self.load_middleware()
[Tue Dec 15 19:57:22.651062 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Tue Dec 15 19:57:22.651083 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] mw_class = import_by_path(middleware_path)
[Tue Dec 15 19:57:22.651094 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 26, in import_by_path
[Tue Dec 15 19:57:22.651111 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] sys.exc_info()[2])
[Tue Dec 15 19:57:22.651119 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
[Tue Dec 15 19:57:22.651131 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] module = import_module(module_path)
[Tue Dec 15 19:57:22.651140 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
[Tue Dec 15 19:57:22.651154 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] __import__(name)
[Tue Dec 15 19:57:22.651184 2015] [:error] [pid 29184:tid 139688107046656] [client 107.143.109.119:50978] ImproperlyConfigured: Error importing module django.middleware.security: "No module named security"
[Tue Dec 15 19:57:22.719625 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] mod_wsgi (pid=29184): Exception occurred processing WSGI script '/var/www/MYSITE/MYSITE/wsgi.py'., referer: http://MY_IP/
[Tue Dec 15 19:57:22.719704 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] Traceback (most recent call last):, referer: http://MY_IP/
[Tue Dec 15 19:57:22.719756 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__, referer: http://MY_IP/
[Tue Dec 15 19:57:22.719834 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] self.load_middleware(), referer: http://MY_IP/
[Tue Dec 15 19:57:22.719855 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware, referer: http://MY_IP/
[Tue Dec 15 19:57:22.719878 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] mw_class = import_by_path(middleware_path), referer: http://MY_IP/
[Tue Dec 15 19:57:22.719890 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 26, in import_by_path, referer: http://MY_IP/
[Tue Dec 15 19:57:22.719911 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] sys.exc_info()[2]), referer: http://MY_IP/
[Tue Dec 15 19:57:22.719921 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 21, in import_by_path, referer: http://MY_IP/
[Tue Dec 15 19:57:22.719958 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] module = import_module(module_path), referer: http://MY_IP/
[Tue Dec 15 19:57:22.719971 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module, referer: http://MY_IP/
[Tue Dec 15 19:57:22.719989 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] __import__(name), referer: http://MY_IP/
[Tue Dec 15 19:57:22.720022 2015] [:error] [pid 29184:tid 139688098653952] [client 107.143.109.119:50977] ImproperlyConfigured: Error importing module django.middleware.security: "No module named security", referer: http://MY_IP/
wsgi.py:
import os, sys
sys.path.append('/var/www/MYSITE')
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MYSITE.settings")
application = get_wsgi_application()
Apache Virtual Host:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port t$
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName MYSITEinc.com
ServerAlias www.MYSITEinc.com
ServerAdmin email#site.com
DocumentRoot /var/www/MYSITE
WSGIScriptAlias / /var/www/MYSITE/MYSITE/wsgi.py
<Directory /var/www/MYSITE/MYSITE>
Require all granted
</Directory>
Alias /static /var/www/MYSITE/static
<Directory /var/www/MYSITE/static>
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = ‘KEY’
DEBUG = False
CSRF_COOKIE_SECURE = False
SESSION_COOKIE_SECURE = False
ADMINS = ((‘Name’), ‘name#site.com’)
MANAGERS = ((‘Name’), ‘name#site.com’)
ALLOWED_HOSTS = [
‘IP_ADDRESS’, ‘MYSITE.com',
]
INSTALLED_APPS = (
'django_admin_bootstrapped',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'web',
'bootstrap3',
'feedparser',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = ‘MYSITE.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
],
},
},
]
WSGI_APPLICATION = 'MYSITE.wsgi.application'
AUTH_USER_MODEL = 'web.User'
LOGIN_URL = '/login/'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'MYSITE',
'USER': 'root',
'PASSWORD': ‘PASSWORD’,
'HOST': ‘IP_ADDRESS’,
'PORT': '3306',
}
}
CONN_MAX_AGE = None
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = '/Users/MYNAME/MYSITE/'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'MYSITE#gmail.com'
EMAIL_HOST_PASSWORD = ‘PASSWORD’
If anyone has suggestions or solutions, can you please post them?

I believe you have your middleware in the wrong order.
Try putting your session middleware BEFORE your auth middleware (error in your logs indicates this problem).
The Django documentation covers middleware ordering as well.

Related

Apache2.4 mod_wsgi error: Forbidden You don't have permission to access / on this server

I'm using Ubuntu 14.04.
I create a django project under /opt/cashpro/python_app/cashsite/trunk/cash
and create a wsgi file cash.wsgi in the same directory
Here is the content of cash.wsgi
import os
import sys
path = '/opt/cashpro/python_app/cashsite/trunk/'
sys.path.insert(0, path)
from cash import settings
import django.core.management
sys.path.insert(1, '/opt/cashpro/python_app/cashsite/trunk/cash/')
django.core.management.setup_environ(settings)
utility = django.core.management.ManagementUtility()
command = utility.fetch_command('runserver')
command.validate()
import django.conf
import django.utils
django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
and here is what I add to my httpd.conf:
<VirtualHost *:443>
ServerName www.abcd.org
DocumentRoot /var/www/test
SSLEngine on
SSLCipherSuite HIGH:+MEDIUM:!SSLv2:!EXP:!ADH:!aNULL:!eNULL:!NULL
SSLCertificateFile "/opt/certs/www.abcd.org.crt"
SSLCertificateKeyFile "/opt/ssl/www.abcd.key"
SSLCertificateChainFile "/opt/certs/DigiCertCA.crt"
#SSLCertificateChainFile "/opt/ssl/IntermediatesCA3.crt"
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
Alias /media-cash/ /opt/cashpro/cashfiles
<Directory /opt/cashpro/cashfiles>
Options MultiViews
AllowOverride None
Require all granted
</Directory>
WSGIPassAuthorization On
WSGIScriptAlias /site
/opt/cashpro/python_app/cashsite/trunk/cash/cash.wsgi
ErrorLog /var/log/apache2/serror.log
CustomLog /var/log/apache2/saccess.log common
</VirtualHost>
The problem is, when I visit https://www.abcd.org/site, it says
Forbidden
You don't have permission to access / on this server.
Apache Error log
[Thu Jul 20 22:24:56.263573 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] mod_wsgi (pid=4448): Target WSGI script
'/opt/cashpro/python_app/cashsite/trunk/cash/cash.wsgi' cannot be loaded as
Python module., referer: https://www.abcd.org
[Thu Jul 20 22:24:56.263816 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] mod_wsgi (pid=4448): Exception occurred
processing WSGI script
'/opt/cashpro/python_app/cashsite/trunk/cash/cash.wsgi'., referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.263978 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] Traceback (most recent call last):, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264085 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File
"/opt/cashpro/python_app/cashsite/trunk/cash/cash.wsgi", line 11, in
<module>, referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264223 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] command =
utility.fetch_command('runserver'), referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264261 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 261, in fetch_command,
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264325 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] klass = load_command_class(app_name,
subcommand), referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264360 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 69, in
load_command_class, referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264410 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] module =
import_module('%s.management.commands.%s' % (app_name, name)), referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264452 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/utils/importlib.py", line 35, in import_module, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264495 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] __import__(name), referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264524 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/core/management/commands/runserver.py", line 8, in <module>,
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264570 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] from django.core.servers.basehttp import
AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application,
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264599 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/core/servers/basehttp.py", line 26, in <module>, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264637 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] from django.views import static, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264665 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/views/static.py", line 95, in <module>, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264700 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] template_translatable =
ugettext_noop(u"Index of %(directory)s"), referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264727 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/utils/translation/__init__.py", line 75, in gettext_noop,
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264780 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] return _trans.gettext_noop(message),
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264821 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/utils/translation/__init__.py", line 48, in __getattr__,
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.264852 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] if settings.USE_I18N:, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264879 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/utils/functional.py", line 184, in inner, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264912 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] self._setup(), referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264938 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/conf/__init__.py", line 42, in _setup, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.264987 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] self._wrapped = Settings(settings_module),
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.265015 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/local/lib/python2.7/dist-
packages/django/conf/__init__.py", line 135, in __init__, referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.265044 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] logging_config_func(self.LOGGING),
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.265071 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/lib/python2.7/logging/config.py",
line 794, in dictConfig, referer: https://www.abcd.org
[Thu Jul 20 22:24:56.265116 2017] [:error] [pid 4448:tid 140570219427584] [
client xxx.xxx.xxx.xxx:3340] dictConfigClass(config).configure(),
referer: https://www.abcd.org
[Thu Jul 20 22:24:56.265151 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] File "/usr/lib/python2.7/logging/config.py",
line 576, in configure, referer: https://www.abcd.org
[Thu Jul 20 22:24:56.265201 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] '%r: %s' % (name, e)), referer:
https://www.abcd.org
[Thu Jul 20 22:24:56.265284 2017] [:error] [pid 4448:tid 140570219427584]
[client xxx.xxx.xxx.xxx:3340] ValueError: Unable to configure handler
'default': [Errno 13] Permission denied: '/opt/cash_site.log', referer:
https://www.abcd.org
Another python web app host the same server.But getting error
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName www.xyz.com
ServerAlias xyz.com
DocumentRoot /opt/nadasnapp/html
<Directory /opt/nadasnapp/html/>
Require all granted
AllowOverride All
</Directory>
LogLevel warn
##FOR NADA
Alias /media/ /opt/nadasnapp/python_app/NaDaWebPro/media/
<Directory /opt/nadasnapp/python_app/NaDaWebPro/media/>
Require all granted
AllowOverride All
</Directory>
Alias /static/ /opt/nadasnapp/python_app/NaDaWebPro/static_root/
<Directory /opt/nadasnapp/python_app/NaDaWebPro/static_root/>
Require all granted
AllowOverride All
</Directory>
#FOR NADA
WSGIPassAuthorization On
WSGIScriptAlias / /opt/nadasnapp/python_app/NaDaWebPro/nada/wsgi.py
<Directory /opt/nadasnapp/python_app/NaDaWebPro/nada>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
The error is
[Sun Jul 23 04:23:14.151745 2017] [:error] [pid 4594:tid
139820915422976]
[client xxx.xxx.xxx.xxx:2244] mod_wsgi (pid=4594): Exception occurred
processing WSGI script
'/opt/nadasnapp/python_app/NaDaWebPro/nada/wsgi.py'.
[Sun Jul 23 04:23:14.151993 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] Traceback (most recent call last):
[Sun Jul 23 04:23:14.152065 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] File "/usr/local/lib/python2.7/dist-
packages/django/core/handlers/wsgi.py", line 219, in __call__
[Sun Jul 23 04:23:14.152135 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] self.load_middleware()
[Sun Jul 23 04:23:14.152166 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] File "/usr/local/lib/python2.7/dist-
packages/django/core/handlers/base.py", line 39, in load_middleware
[Sun Jul 23 04:23:14.152203 2017] [:error] [pid 4594:tid 1
39820915422976]
[client xxx.xxx.xxx.xxx:2244] for middleware_path in
settings.MIDDLEWARE_CLASSES:
[Sun Jul 23 04:23:14.152234 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] File "/usr/local/lib/python2.7/dist-
packages/django/utils/functional.py", line 184, in inner
[Sun Jul 23 04:23:14.152319 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] self._setup()
[Sun Jul 23 04:23:14.152357 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] File "/usr/local/lib/python2.7/dist-
packages/django/conf/__init__.py", line 42, in _setup
[Sun Jul 23 04:23:14.152402 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] self._wrapped =
Settings(settings_module)
[Sun Jul 23 04:23:14.152445 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] File "/usr/local/lib/python2.7/dist-
packages/django/conf/__init__.py", line 95, in __init__
[Sun Jul 23 04:23:14.152484 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] raise ImportError("Could not import
settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Sun Jul 23 04:23:14.152540 2017] [:error] [pid 4594:tid 139820915422976]
[client xxx.xxx.xxx.xxx:2244] ImportError: Could not import settings
'cash.settings' (Is it on sys.path?): No module named cash.settings
The directory you gave as argument to the Directory directive was /opt/cashpro/cashfiles, it should be /opt/cashpro/python_app/cashsite/trunk/cash/. That is, where the WSGI script file is located.

Internal Server Error Django/apache

My Django app was working fine, but now I'm getting a server error, the last thing I did was a reboot to my Centos7 Server and now I'm getting this error:
and this are my logs I'm using apache:
[Thu Mar 30 14:04:10.571843 2017] [:error] [pid 11335] [remote 10.221.50.100:24] mod_wsgi (pid=11335): Target WSGI script '/opt/btsystem/BTSystem/wsgi.py' cannot be loaded as Python module.
[Thu Mar 30 14:04:10.571991 2017] [:error] [pid 11335] [remote 10.221.50.100:24] mod_wsgi (pid=11335): Exception occurred processing WSGI script '/opt/btsystem/BTSystem/wsgi.py'.
[Thu Mar 30 14:04:10.572263 2017] [:error] [pid 11335] [remote 10.221.50.100:24] Traceback (most recent call last):
[Thu Mar 30 14:04:10.572544 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/opt/btsystem/BTSystem/wsgi.py", line 16, in <module>
[Thu Mar 30 14:04:10.572795 2017] [:error] [pid 11335] [remote 10.221.50.100:24] application = get_wsgi_application()
[Thu Mar 30 14:04:10.572919 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Mar 30 14:04:10.573054 2017] [:error] [pid 11335] [remote 10.221.50.100:24] django.setup(set_prefix=False)
[Thu Mar 30 14:04:10.573107 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/site-packages/django/__init__.py", line 22, in setup
[Thu Mar 30 14:04:10.573170 2017] [:error] [pid 11335] [remote 10.221.50.100:24] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Thu Mar 30 14:04:10.573261 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/site-packages/django/utils/log.py", line 75, in configure_logging
[Thu Mar 30 14:04:10.573312 2017] [:error] [pid 11335] [remote 10.221.50.100:24] logging_config_func(logging_settings)
[Thu Mar 30 14:04:10.573369 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/logging/config.py", line 803, in dictConfig
[Thu Mar 30 14:04:10.573409 2017] [:error] [pid 11335] [remote 10.221.50.100:24] dictConfigClass(config).configure()
[Thu Mar 30 14:04:10.573455 2017] [:error] [pid 11335] [remote 10.221.50.100:24] File "/usr/lib64/python2.7/logging/config.py", line 585, in configure
[Thu Mar 30 14:04:10.573501 2017] [:error] [pid 11335] [remote 10.221.50.100:24] '%r: %s' % (name, e))
[Thu Mar 30 14:04:10.573567 2017] [:error] [pid 11335] [remote 10.221.50.100:24] ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/opt/btsystem-logs/btsystem-debug.log'
Any idea?
The last line shows that Django doesn't have permission to write to the configured log file.
[Thu Mar 30 14:04:10.573567 2017] [:error] [pid 11335] [remote 10.221.50.100:24] ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/opt/btsystem-logs/btsystem-debug.log'
Make sure the file /opt/btsystem-logs/btsystem-debug.log is writeable by the user running the Django server.
The main problem was that I needed to do the following to enable the virtual host from Apache:
firewall-cmd --get-active-zones
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Needed to open the ports.

RuntimeError: populate() isn't reentrant in Django

I am trying to deploy django website.Project name is pom.
I am trying to run django website in ec2 server using apache2 and getting the following error:
Apache error file:
[Fri Jul 24 12:37:33.621285 2015] [:info] [pid 20446:tid 140024755709824] mod_wsgi (pid=20446): Attach interpreter ''.
[Fri Jul 24 12:37:33.621462 2015] [:info] [pid 20446:tid 140024755709824] mod_wsgi (pid=20446): Adding '/home/ubuntu/.virtualenvs/edusamosa/lib/python2.7/site-packages/' to path.
[Fri Jul 24 12:37:44.145762 2015] [authz_core:debug] [pid 20448:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11934] AH01626: authorization result of Require all granted: granted
[Fri Jul 24 12:37:44.145888 2015] [authz_core:debug] [pid 20448:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11934] AH01626: authorization result of <RequireAny>: granted
[Fri Jul 24 12:37:44.145947 2015] [authz_core:debug] [pid 20448:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11934] AH01626: authorization result of Require all granted: granted
[Fri Jul 24 12:37:44.145953 2015] [authz_core:debug] [pid 20448:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11934] AH01626: authorization result of <RequireAny>: granted
[Fri Jul 24 12:37:44.152795 2015] [:info] [pid 20446:tid 140024564070144] mod_wsgi (pid=20446): Create interpreter 'www.edusamosa.in|'.
[Fri Jul 24 12:37:44.153592 2015] [:info] [pid 20446:tid 140024564070144] mod_wsgi (pid=20446): Adding '/home/ubuntu/.virtualenvs/edusamosa/lib/python2.7/site-packages/' to path.
[Fri Jul 24 12:37:44.152795 2015] [:info] [pid 20446:tid 140024564070144] mod_wsgi (pid=20446): Create interpreter 'www.edusamosa.in|'.
[Fri Jul 24 12:37:44.153592 2015] [:info] [pid 20446:tid 140024564070144] mod_wsgi (pid=20446): Adding '/home/ubuntu/.virtualenvs/edusamosa/lib/python2.7/site-packages/' to path.
[Fri Jul 24 12:37:44.153884 2015] [:info] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] mod_wsgi (pid=20446, process='pom', application='www.edusamosa.in|'): Loading WSGI script '/home/ubuntu/pom/pom/wsgi.py'.
[Fri Jul 24 12:37:44.354165 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] mod_wsgi (pid=20446): Target WSGI script '/home/ubuntu/pom/pom/wsgi.py' cannot be loaded as Python module.
[Fri Jul 24 12:37:44.354189 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] mod_wsgi (pid=20446): Exception occurred processing WSGI script '/home/ubuntu/pom/pom/wsgi.py'.
[Fri Jul 24 12:37:44.354222 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] Traceback (most recent call last):
[Fri Jul 24 12:37:44.354238 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/home/ubuntu/pom/pom/wsgi.py", line 19, in <module>
[Fri Jul 24 12:37:44.354362 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] application = get_wsgi_application()
# [Fri Jul 24 12:37:44.354238 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/home/ubuntu/pom/pom/wsgi.py", line 19, in <module>
[Fri Jul 24 12:37:44.354362 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] application = get_wsgi_application()
[Fri Jul 24 12:37:44.354377 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Fri Jul 24 12:37:44.354416 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] django.setup()
[Fri Jul 24 12:37:44.354428 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
[Fri Jul 24 12:37:44.354465 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] apps.populate(settings.INSTALLED_APPS)
[Fri Jul 24 12:37:44.354476 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
[Fri Jul 24 12:37:44.354590 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] app_config = AppConfig.create(entry)
[Fri Jul 24 12:37:44.354602 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 86, in create
[Fri Jul 24 12:37:44.354590 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] app_config = AppConfig.create(entry)
[Fri Jul 24 12:37:44.354602 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 86, in create
[Fri Jul 24 12:37:44.354697 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] module = import_module(entry)
[Fri Jul 24 12:37:44.354708 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Jul 24 12:37:44.354765 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] __import__(name)
[Fri Jul 24 12:37:44.354793 2015] [:error] [pid 20446:tid 140024564070144] [remote 49.248.57.164:51213] ImportError: No module named allauth
[Fri Jul 24 12:37:45.251341 2015] [authz_core:debug] [pid 20447:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11938] AH01626: authorization result of Require all granted: granted, referer: http://edusamosa.in/
[Fri Jul 24 12:37:45.251496 2015] [authz_core:debug] [pid 20447:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11938] AH01626: authorization result of <RequireAny>: granted, referer: http://edusamosa.in/
[Fri Jul 24 12:37:45.251559 2015] [authz_core:debug] [pid 20447:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11938] AH01626: authorization result of Require all granted: granted, referer: http://edusamosa.in/
[Fri Jul 24 12:37:45.251496 2015] [authz_core:debug] [pid 20447:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11938] AH01626: authorization result of <RequireAny>: granted, referer: http://edusamosa.in/
[Fri Jul 24 12:37:45.251559 2015] [authz_core:debug] [pid 20447:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11938] AH01626: authorization result of Require all granted: granted, referer: http://edusamosa.in/
[Fri Jul 24 12:37:45.251565 2015] [authz_core:debug] [pid 20447:tid 140024656201472] mod_authz_core.c(802): [client 49.248.57.164:11938] AH01626: authorization result of <RequireAny>: granted, referer: http://edusamosa.in/
[Fri Jul 24 18:07:45.251722 2015] [:info] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] mod_wsgi (pid=20446, process='pom', application='www.edusamosa.in|'): Loading WSGI script '/home/ubuntu/pom/pom/wsgi.py'.
[Fri Jul 24 18:07:45.252817 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] mod_wsgi (pid=20446): Target WSGI script '/home/ubuntu/pom/pom/wsgi.py' cannot be loaded as Python module.
[Fri Jul 24 18:07:45.252831 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] mod_wsgi (pid=20446): Exception occurred processing WSGI script '/home/ubuntu/pom/pom/wsgi.py'.
[Fri Jul 24 18:07:45.252850 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] Traceback (most recent call last):
[Fri Jul 24 18:07:45.252870 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] File "/home/ubuntu/pom/pom/wsgi.py", line 19, in <module>
[Fri Jul 24 18:07:45.252850 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] Traceback (most recent call last):
[Fri Jul 24 18:07:45.252870 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] File "/home/ubuntu/pom/pom/wsgi.py", line 19, in <module>
[Fri Jul 24 18:07:45.252913 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] application = get_wsgi_application()
[Fri Jul 24 18:07:45.252923 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Fri Jul 24 18:07:45.252940 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] django.setup()
[Fri Jul 24 18:07:45.252948 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
[Fri Jul 24 18:07:45.252961 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] apps.populate(settings.INSTALLED_APPS)
[Fri Jul 24 18:07:45.252969 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 78, in populate
[Fri Jul 24 18:07:45.252981 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] raise RuntimeError("populate() isn't reentrant")
#
# [Fri Jul 24 18:07:45.252969 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 78, in populate
[Fri Jul 24 18:07:45.252981 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] raise RuntimeError("populate() isn't reentrant")
[Fri Jul 24 18:07:45.252996 2015] [:error] [pid 20446:tid 140024648070912] [remote 49.248.57.164:58879] RuntimeError: populate() isn't reentrant
~
My pom.settings.py is as follow:
"""
Django settings for pom project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
ALLOWED_HOSTS = ['*']
# Application definition
'''
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
# other finders..
# 'compressor.finders.CompressorFinder',
)
'''
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
'ckeditor',
'reviewandrating',
'links',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.linkedin',
'import_export',
'haystack',
'mathfilters',
)
# Ankur's Setting.py
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
"django.core.context_processors.request",
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'allauth.account.context_processors.account',
)
SITE_ID = 3
AUTH_PROFILE_MODULE = 'links.UserProfile'
LOGIN_URL = '/'
SOCIALACCOUNT_ADAPTER = 'links.my_adapter.MyAdapter'
SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_PROVIDERS = {
'facebook': {
'SCOPE': ['email'],
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
'METHOD': 'js_sdk',
'VERIFIED_EMAIL': False
},
'google':
{'SCOPE': ['profile', 'email'],
'AUTH_PARAMS': {'access_type': 'online'}},
'linkedin':
{'SCOPE': ['r_emailaddress'],
'PROFILE_FIELDS': ['id',
'first-name',
'last-name',
'email-address',
'picture-url',
'public-profile-url']}
}
LOGIN_REDIRECT_URL = '/'
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'pom.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['/home/ubuntu/pom/templates/'], # This is where you add the template directory
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'allauth.account.context_processors.account',
'allauth.socialaccount.context_processors.socialaccount',
],
},
},
]
WSGI_APPLICATION = 'pom.wsgi.application'
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://localhost:8983/solr/',
'TIMEOUT': 60 * 5,
'INCLUDE_SPELLING': True,
'BATCH_SIZE': 100,
'EXCLUDED_INDEXES': ['thirdpartyapp.search_indexes.BarIndex'],
}
}
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'hidden',
'USER': 'ubuntu',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3306',
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = (
'',
'/home/ubuntu/pom/static/img/',
'/home/ubuntu/pom/static/css/',
'/home/ubuntu/pom/static/js/',
)
# TEMPLATE_LOADERS = (
# 'django.template.loaders.filesystem.Loader',
# 'django.template.loaders.app_directories.Loader',
# #django.template.loaders.eggs.Loader',
# )
TEMPLATE_DIRS = (
# os.path.join(BASE_DIR, 'templates'),
'/home/ubuntu/pom/templates/',
)
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'full',
'height': 300,
'width': 900,
},
}
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_IMAGE_BACKEND = 'Pillow'
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
STATIC_ROOT = '/home/ubuntu/pom/static/'
MEDIA_ROOT = '/home/ubuntu/pom/media/'
MEDIA_URL = '/media/'
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
The wsgi.py file is as follows:
"""
WSGI config for pom project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
import sys
from os.path import abspath, dirname, join
#sys.path.insert(0, '/home/ubuntu/deploy/pom')
sys.path.insert(0, abspath(join(dirname(__file__), "../")))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pom.settings")
application = get_wsgi_application()
The error messages clearly says:
ImportError: No module named allauth
The populate() not reentrant error is an error that occurs when mod_wsgi attempts to reload the WSGI script file, after the first error, and finds that Django was half initialised due to first error and so it gives up.
Fix the issue with allauth module not being found and the latter error should go away.

Deploy django1.8 in a production server Apache+ mod_wsgi

I'm trying to do the deploy at my project with django1.8, using apache 2.x and mod_wsgi, the structure of my project is (pd: mi proyect is in /var/www)
projectdjango
apps -- (my django-apps)
....
projectdjango
settings
local.py
staging.py
url.py
static
templates
....
manage.py
projectdjango.wsgi
the code I'm using for the httpd.conf is
<VirtualHost *:80>
ServerName projectdjango.com
DocumentRoot /var/www/projectdjango
<Directory /var/www/ >
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess projectdjango.com processes=2 threads=15
WSGIProcessGroup projectdjango.com
WSGIScriptAlias / /var/www/projectdjango/projectdjango.wsgi
</VirtualHost>
and the code for projectdjango.wsgi is
import os
import sys
sys.path.append('/var/www')
sys.path.append('/var/www/projectdjango')
os.environ['DJANGO_SETTINGS_MODULE'] = 'projectdjango.settings.staging'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
error.log
[Thu Apr 23 16:44:48.540206 2015] [core:notice] [pid 21662:tid 140482308327296] AH00094: Command line: '/usr/sbin/apache2'
[Thu Apr 23 16:45:43.715053 2015] [mpm_event:notice] [pid 21662:tid 140482308327296] AH00491: caught SIGTERM, shutting down
[Thu Apr 23 16:45:44.907958 2015] [mpm_event:notice] [pid 21779:tid 140246657443712] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming n$
[Thu Apr 23 16:45:44.908339 2015] [core:notice] [pid 21779:tid 140246657443712] AH00094: Command line: '/usr/sbin/apache2'
[Thu Apr 23 16:48:31.071450 2015] [mpm_event:notice] [pid 21779:tid 140246657443712] AH00491: caught SIGTERM, shutting down
[Thu Apr 23 16:48:32.282889 2015] [mpm_event:notice] [pid 21909:tid 140394885306240] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming n$
[Thu Apr 23 16:48:32.283273 2015] [core:notice] [pid 21909:tid 140394885306240] AH00094: Command line: '/usr/sbin/apache2'
[Thu Apr 23 21:49:47.620133 2015] [:error] [pid 21911:tid 140394723014400] No handlers could be found for logger "django.request"
[Thu Apr 23 21:49:47.842564 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] mod_wsgi (pid=21911): Exception occurred processing WSGI script '/$
[Thu Apr 23 21:49:47.842699 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] Traceback (most recent call last):
[Thu Apr 23 21:49:47.842771 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/core/handler$
[Thu Apr 23 21:49:47.844350 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] response = self.get_response(request)
[Thu Apr 23 21:49:47.844455 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/core/handler$
[Thu Apr 23 21:49:47.844851 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] response = self.handle_uncaught_exception(request, resolver, s$
[Thu Apr 23 21:49:47.844904 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/core/handler$
[Thu Apr 23 21:49:47.844979 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return debug.technical_500_response(request, *exc_info)
[Thu Apr 23 21:49:47.845023 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.$
[Thu Apr 23 21:49:47.846871 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] html = reporter.get_traceback_html()
[Thu Apr 23 21:49:47.846981 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.$
[Thu Apr 23 21:49:47.847070 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return t.render(c)
[Thu Apr 23 21:49:47.847112 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/template/bas$
[Thu Apr 23 21:49:47.848209 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return self._render(context)
[Thu Apr 23 21:49:47.848293 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/template/bas$
[Thu Apr 23 21:49:47.848394 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return self.nodelist.render(context)
[Thu Apr 23 21:49:47.850682 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/encodi$
[Thu Apr 23 21:49:47.851014 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] s = six.text_type(s)
[Thu Apr 23 21:49:47.851063 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/functi$
[Thu Apr 23 21:49:47.851538 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return func(*self.__args, **self.__kw)
[Thu Apr 23 21:49:47.851600 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.851879 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return _trans.ugettext(message)
[Thu Apr 23 21:49:47.851963 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.852729 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] return do_translate(message, 'ugettext')
[Thu Apr 23 21:49:47.852805 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.852891 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] _default = _default or translation(settings.LANGUAGE_CODE)
[Thu Apr 23 21:49:47.852933 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.852997 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] _translations[language] = DjangoTranslation(language)
[Thu Apr 23 21:49:47.853037 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.853102 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] self._add_installed_apps_translations()
[Thu Apr 23 21:49:47.853143 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] File "/usr/local/lib/python2.7/dist-packages/django/utils/transl$
[Thu Apr 23 21:49:47.853208 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] "The translation infrastructure cannot be initialized before t$
[Thu Apr 23 21:49:47.853392 2015] [:error] [pid 21911:tid 140394723014400] [remote 127.0.0.1:16955] AppRegistryNotReady: The translation infrastructure cannot be init$
I hope someone can help me what i'm doing wrong

Django WSGI not working with apache

I'm trying to configure the WSGI in Apache to work with Django but it's not working, when I go to domain.com it gives me an error 500.
But If I start Django using:
python manage.py runserver domain.com:8000
When I go to domain.com:8000 works perfectly so I think It's something about apache and WSGI.
Here you have my WSGI script:
import os
import sys
sys.path.append('/var/www/domain/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'domain.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
My VirtualHost configuration:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.domain.com
ServerAdmin info#domain.com
ServerAlias domain.com
DocumentRoot /var/www/domain
WSGIScriptAlias / /var/www/domain/domain.wsgi
#Alias /static/ /var/www/domain/static/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
I'm using Ubuntu 14.04. I tried looking at logs but I have no idea what's wrong.
Logs:
[Thu Sep 25 10:15:09.549670 2014] [:error] [pid 17141] [client 88.12.185.72:65477] mod_wsgi (pid=17141): Exception occurred processing WSGI script '/var/www/domain/domain.wsgi'.
[Thu Sep 25 10:15:09.549722 2014] [:error] [pid 17141] [client 88.12.185.72:65477] Traceback (most recent call last):
[Thu Sep 25 10:15:09.549747 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Thu Sep 25 10:15:09.549880 2014] [:error] [pid 17141] [client 88.12.185.72:65477] response = self.get_response(request)
[Thu Sep 25 10:15:09.549899 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 199, in get_response
[Thu Sep 25 10:15:09.550029 2014] [:error] [pid 17141] [client 88.12.185.72:65477] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Thu Sep 25 10:15:09.550048 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 236, in handle_uncaught_exception
[Thu Sep 25 10:15:09.550075 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return debug.technical_500_response(request, *exc_info)
[Thu Sep 25 10:15:09.550091 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 91, in technical_500_response
[Thu Sep 25 10:15:09.550492 2014] [:error] [pid 17141] [client 88.12.185.72:65477] html = reporter.get_traceback_html()
[Thu Sep 25 10:15:09.550513 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 350, in get_traceback_html
[Thu Sep 25 10:15:09.550539 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return t.render(c)
[Thu Sep 25 10:15:09.550554 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 148, in render
[Thu Sep 25 10:15:09.550984 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return self._render(context)
[Thu Sep 25 10:15:09.551006 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 142, in _render
[Thu Sep 25 10:15:09.551034 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return self.nodelist.render(context)
[Thu Sep 25 10:15:09.551048 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 844, in render
[Thu Sep 25 10:15:09.551071 2014] [:error] [pid 17141] [client 88.12.185.72:65477] bit = self.render_node(node, context)
[Thu Sep 25 10:15:09.551084 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 80, in render_node
[Thu Sep 25 10:15:09.551174 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return node.render(context)
[Thu Sep 25 10:15:09.551192 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 90, in render
[Thu Sep 25 10:15:09.551217 2014] [:error] [pid 17141] [client 88.12.185.72:65477] output = self.filter_expression.resolve(context)
[Thu Sep 25 10:15:09.551231 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 624, in resolve
[Thu Sep 25 10:15:09.551268 2014] [:error] [pid 17141] [client 88.12.185.72:65477] new_obj = func(obj, *arg_vals)
[Thu Sep 25 10:15:09.551284 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 769, in date
[Thu Sep 25 10:15:09.551595 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return format(value, arg)
[Thu Sep 25 10:15:09.551615 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 343, in format
[Thu Sep 25 10:15:09.551759 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return df.format(format_string)
[Thu Sep 25 10:15:09.551778 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 35, in format
[Thu Sep 25 10:15:09.551817 2014] [:error] [pid 17141] [client 88.12.185.72:65477] pieces.append(force_text(getattr(self, piece)()))
[Thu Sep 25 10:15:09.551834 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 268, in r
[Thu Sep 25 10:15:09.551857 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return self.format('D, j M Y H:i:s O')
[Thu Sep 25 10:15:09.551871 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 35, in format
[Thu Sep 25 10:15:09.551892 2014] [:error] [pid 17141] [client 88.12.185.72:65477] pieces.append(force_text(getattr(self, piece)()))
[Thu Sep 25 10:15:09.551907 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 85, in force_text
[Thu Sep 25 10:15:09.552021 2014] [:error] [pid 17141] [client 88.12.185.72:65477] s = six.text_type(s)
[Thu Sep 25 10:15:09.552039 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 144, in __text_cast
[Thu Sep 25 10:15:09.552276 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return func(*self.__args, **self.__kw)
[Thu Sep 25 10:15:09.552297 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 83, in ugettext
[Thu Sep 25 10:15:09.552412 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return _trans.ugettext(message)
[Thu Sep 25 10:15:09.552431 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 325, in ugettext
[Thu Sep 25 10:15:09.552686 2014] [:error] [pid 17141] [client 88.12.185.72:65477] return do_translate(message, 'ugettext')
[Thu Sep 25 10:15:09.552706 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 306, in do_translate
[Thu Sep 25 10:15:09.552731 2014] [:error] [pid 17141] [client 88.12.185.72:65477] _default = translation(settings.LANGUAGE_CODE)
[Thu Sep 25 10:15:09.552746 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 209, in translation
[Thu Sep 25 10:15:09.552768 2014] [:error] [pid 17141] [client 88.12.185.72:65477] default_translation = _fetch(settings.LANGUAGE_CODE)
[Thu Sep 25 10:15:09.552782 2014] [:error] [pid 17141] [client 88.12.185.72:65477] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 189, in _fetch
[Thu Sep 25 10:15:09.552804 2014] [:error] [pid 17141] [client 88.12.185.72:65477] "The translation infrastructure cannot be initialized before the "
[Thu Sep 25 10:15:09.552830 2014] [:error] [pid 17141] [client 88.12.185.72:65477] AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
Anyone knows what I'm doing wrong?
Thanks
I discover that the version of Django in my production server is 1.7.0 and in Development server is 1.6.4. After downgrade Django works fine.
sudo pip install django==1.6.4