Reputation: 3
I installed django+mezzanine+mysql+apache2+nginx.
[Sun Mar 23 10:01:02.382418 2014] [authz_core:debug] [pid 1131] mod_authz_core.c(828): [client xxx.xxx.xxx.xxx:36626] AH01628: authorization result: granted (no directives)
[Sun Mar 23 10:01:02.382520 2014] [authz_core:debug] [pid 1131] mod_authz_core.c(828): [client xxx.xxx.xxx.xxx:36626] AH01628: authorization result: granted (no directives)
[Sun Mar 23 10:01:02.384258 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] mod_wsgi (pid=1131): Exception occurred processing WSGI script '/var/www/admin/data/www/sitename/django.wsgi'.
[Sun Mar 23 10:01:02.384297 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] Traceback (most recent call last):
[Sun Mar 23 10:01:02.384328 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/var/www/admin/data/www/sitename/django.wsgi", line 36, in application
[Sun Mar 23 10:01:02.384374 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] return _application(environ, start_response)
[Sun Mar 23 10:01:02.384391 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 219, in __call__
[Sun Mar 23 10:01:02.384417 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] self.load_middleware()
[Sun Mar 23 10:01:02.384432 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 39, in load_middleware
[Sun Mar 23 10:01:02.384455 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Sun Mar 23 10:01:02.384469 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 184, in inner
[Sun Mar 23 10:01:02.384492 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] self._setup()
[Sun Mar 23 10:01:02.384506 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup
[Sun Mar 23 10:01:02.384528 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] self._wrapped = Settings(settings_module)
[Sun Mar 23 10:01:02.384541 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 93, in __init__
[Sun Mar 23 10:01:02.384563 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] mod = importlib.import_module(self.SETTINGS_MODULE)
[Sun Mar 23 10:01:02.384577 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
[Sun Mar 23 10:01:02.384598 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] __import__(name)
[Sun Mar 23 10:01:02.384650 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] File "/var/www/admin/data/www/sitename/edparfum-app/settings.py", line 311
[Sun Mar 23 10:01:02.384661 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] 'USER': \xe2\x80\x98root\xe2\x80\x99,
[Sun Mar 23 10:01:02.384671 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] ^
[Sun Mar 23 10:01:02.384678 2014] [:error] [pid 1131] [client xxx.xxx.xxx.xxx:36626] SyntaxError: invalid syntax
here's the file contents: /var/www/admin/data/www/sitename/django.wsgi
import os, sys
from urllib import quote
sys.path.append('/var/www/admin/data/www/sitename/edparfum-app')
sys.path.append('/var/www/admin/data/www/sitename/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
_application = django.core.handlers.wsgi.WSGIHandler()
def reconstruct_url(environ, HTTP_HOST=None):
url = environ['wsgi.url_scheme']+'://'
if environ.get('HTTP_HOST') and not HTTP_HOST:
url += environ['HTTP_HOST']
elif HTTP_HOST:
url += HTTP_HOST
else:
url += environ['SERVER_NAME']
if environ['wsgi.url_scheme'] == 'https':
if environ['SERVER_PORT'] != '443':
url += ':' + environ['SERVER_PORT']
else:
if environ['SERVER_PORT'] != '80':
url += ':' + environ['SERVER_PORT']
url += quote(environ.get('SCRIPT_NAME', ''))
url += quote(environ.get('PATH_INFO', ''))
if environ.get('QUERY_STRING'):
url += '?' + environ['QUERY_STRING']
return url
def application(environ, start_response):
if environ['HTTP_HOST'] == 'www.sitename.ru':
tourl = reconstruct_url(environ, 'sitename.ru')
start_response('301 Redirect', [('Location', tourl),])
return []
return _application(environ, start_response)
Trying to run on the server Django-mezzanne. It seems everything is set up but does not work. I would be grateful for any help. In case you want to publish the contents of other files.
Upvotes: 0
Views: 149
Reputation: 44093
It looks like the text editor you used to edit your settings.py
used unicode quotes ‘’
, rather than the actual apostrophe ''
or quote character ""
. It should be:
'USER': 'root',
Rather than:
'USER': \xe2\x80\x98root\xe2\x80\x99,
The easiest fix would be to copy and paste the quotes around the USER
keyword, but it would be a good idea to find a text editor that uses the proper quotes required by python.
Upvotes: 1