使用应用程序 wagalytics ,
GA_KEY_CONTENT = '{ "type": "service_account", "project_id":...}
作为一条线
我该如何解决错误
Error at /admin/analytics/token/
[('PEM routines', 'PEM_read_bio', 'no start line')]
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/analytics/token/
Django Version: 1.11.11
这是从 url /admin/analytics/token/ 生成的上述错误消息的堆栈跟踪,私钥是从 https://console.developers.google.com/ GA_KEY_FILEPATH json 文件中读取的,下面是堆栈跟踪生成
Traceback (most recent call last):
File "/usr/lib64/python3.6/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/whitenoise/base.py", line 66, in __call__
return self.application(environ, start_response)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 157, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in get_response
response = self._middleware_chain(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/deprecation.py", line 140, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/crum/__init__.py", line 97, in __call__
response = self.get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 43, in inner
response = response_for_exception(request, exc)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/views/decorators/cache.py", line 43, in _cache_controlled
response = viewfunc(request, *args, **kw)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/wagtail/wagtailadmin/urls/__init__.py", line 96, in wrapper
return view_func(request, *args, **kwargs)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/wagtail/wagtailadmin/decorators.py", line 31, in decorated_view
return view_func(request, *args, **kwargs)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/wagalytics/views.py", line 41, in token
access_token = get_access_token_from_str(settings.GA_KEY_CONTENT)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/wagalytics/views.py", line 33, in get_access_token_from_str
keyDict, SCOPE)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/oauth2client/service_account.py", line 264, in from_json_keyfile_dict
revoke_uri=revoke_uri)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/oauth2client/service_account.py", line 196, in _from_parsed_json_keyfile
signer = crypt.Signer.from_string(private_key_pkcs8_pem)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/oauth2client/_openssl_crypt.py", line 119, in from_string
pkey = crypto.load_privatekey(crypto.FILETYPE_PEM, parsed_pem_key)
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/OpenSSL/crypto.py", line 2795, in load_privatekey
_raise_current_error()
File "/home/nzaniela/apps/CODING_DEV_APPS/VIRTUALENV_PROJECTS/businessillustrated/lib/python3.6/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.crypto.Error: [('PEM routines', 'PEM_read_bio', 'no start line')]