社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  问与答

请问如何让 django 跑到更新的 python 版本上

Hiro_Fu • 8 年前 • 4021 次点击  

之前使用 python2.7+supervisor+gunicorn+nginx 部署 django

后来在使用 requests 做微信 App 开发的时候遇到了问题

"hostname 'api.weixin.qq.com' doesn't match u'mp.weixin.qq.com'"

发现在 python 2.7.10 中就没有这个问题

于是使用 pyenv 添加了新版本的 python,并 pyenv global 2.7.10 设置了全局 python 版本

并在 python manage.py shell 中测试了原来出问题的代码,可以被正常调用,也返回了正常的 json

但是重启了 Django App 后发现还是有之前的问题

进 gunicorn.err log 文件查看

发现问题还是和之前是一样的

在 views 中 return 了一下 platform.python_version(),发现是 "version": "2.7.0"

请问我该怎么办呢?

日志如下

/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning

/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:266: SubjectAltNameWarning: Certificate for api.weixin.qq.com has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1383
 
4021 次点击  
文章 [ 2 ]  |  最新文章 8 年前
Hiro_Fu
Reply   •   1 楼
Hiro_Fu    8 年前

覆盖更新后可以了。

Hiro_Fu
Reply   •   2 楼
Hiro_Fu    8 年前

@Django中国社区 老大,求帮助