首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Https://www.example.com“)-request.get(”python在尝试使用Apache和mod_wsgi运行Django应用程序时不起作用

Https://www.example.com“)-request.get(”python在尝试使用Apache和mod_wsgi运行Django应用程序时不起作用
EN

Stack Overflow用户
提问于 2018-07-11 23:37:01
回答 1查看 192关注 0票数 0
代码语言:javascript
复制
import requests

response = requests.get("https://www.example.com")

此操作失败,并显示错误:

代码语言:javascript
复制
Exception Value: Can't convert 'NoneType' object to str implicitly

我尝试了herehere中提到的所有步骤,但都没有成功。

有没有其他方法可以在生产环境中启动django服务器?或者其他在Python 2.x上运行https请求的方式?

我已经尝试过httplib2urllib

已尝试安装httplib,但无法安装。

StackTrace:

代码语言:javascript
复制
None
[Wed Jul 11 17:39:24.537433 2018] [wsgi:error] [pid 22236:tid 139944512608000] Internal Server Error: /myproject/createUser/
[Wed Jul 11 17:39:24.537447 2018] [wsgi:error] [pid 22236:tid 139944512608000] Traceback (most recent call last):
[Wed Jul 11 17:39:24.537450 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 35, in inner
[Wed Jul 11 17:39:24.537453 2018] [wsgi:error] [pid 22236:tid 139944512608000]     response = get_response(request)
[Wed Jul 11 17:39:24.537455 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 128, in _get_response
[Wed Jul 11 17:39:24.537458 2018] [wsgi:error] [pid 22236:tid 139944512608000]     response = self.process_exception_by_middleware(e, request)
[Wed Jul 11 17:39:24.537461 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response
[Wed Jul 11 17:39:24.537464 2018] [wsgi:error] [pid 22236:tid 139944512608000]     response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Wed Jul 11 17:39:24.537467 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
[Wed Jul 11 17:39:24.537470 2018] [wsgi:error] [pid 22236:tid 139944512608000]     return view_func(*args, **kwargs)
[Wed Jul 11 17:39:24.537472 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/django/views/generic/base.py", line 69, in view
[Wed Jul 11 17:39:24.537475 2018] [wsgi:error] [pid 22236:tid 139944512608000]     return self.dispatch(request, *args, **kwargs)
[Wed Jul 11 17:39:24.537477 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/rest_framework/views.py", line 483, in dispatch
[Wed Jul 11 17:39:24.537480 2018] [wsgi:error] [pid 22236:tid 139944512608000]     response = self.handle_exception(exc)
[Wed Jul 11 17:39:24.537483 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/rest_framework/views.py", line 443, in handle_exception
[Wed Jul 11 17:39:24.537485 2018] [wsgi:error] [pid 22236:tid 139944512608000]     self.raise_uncaught_exception(exc)
[Wed Jul 11 17:39:24.537488 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myprojectenv/lib/python3.5/site-packages/rest_framework/views.py", line 480, in dispatch
[Wed Jul 11 17:39:24.537491 2018] [wsgi:error] [pid 22236:tid 139944512608000]     response = handler(request, *args, **kwargs)
[Wed Jul 11 17:39:24.537493 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myapp/views.py", line 88, in get
[Wed Jul 11 17:39:24.537496 2018] [wsgi:error] [pid 22236:tid 139944512608000]     aud,email = getEmailandAud(self,request)
[Wed Jul 11 17:39:24.537498 2018] [wsgi:error] [pid 22236:tid 139944512608000]   File "/home/myproject/myapp/views.py", line 31, in getEmailandAud
[Wed Jul 11 17:39:24.537501 2018] [wsgi:error] [pid 22236:tid 139944512608000]     response = requests.get("https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=" + access_token)
[Wed Jul 11 17:39:24.537505 2018] [wsgi:error] [pid 22236:tid 139944512608000] TypeError: Can't convert 'NoneType' object to str implicitly   
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51289415

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档