ECS使用及环境配置
来源:互联网 发布:fresh 知乎 编辑:程序博客网 时间:2024/06/06 03:48
1.登录ssh root@ip
2.ubuntu 14.04 LTS 阿里云更新源、官方源和第三方更新源列表
能尽量apt-get就apt-get,不要折腾源码安装
3. python重新安装
apt-get remove python
apt-get install python
4. mycli安装
pip install mycli
5.python 虚拟环境[virtualenv/virtualenvwrapper]设置
6.nginx+uwsgi配置
向nginx.conf加入如下
server { listen 80; server_name 47.93.124.181; access_log /root/letfly/firstsite/logs/access.log; error_log /root/letfly/firstsite/logs/error.log; location / { include /etc/nginx/uwsgi_params; uwsgi_pass 127.0.0.1:9090; } }
关闭nginx
nginx -s stop
重链接配置文件
nginx -c /etc/nginx/nginx.conf
重启
nginx -s reload
apt-get install python-devpip install uwsgi
uwsgi9090.ini如下
[uwsgi]vhost = falseplugins = pythonsocket = 127.0.0.1:9090master = trueenable-threads = trueworkers = 1wsgi-file = /root/letfly/firstsite/firstsite/wsgi.pychdir = /root/letfly/firstsite运行
uwsgi --ini uwsgi9090.ini&
7.ubuntu安装vim8.0
sudo add-apt-repository ppa:jonathonf/vim
sudo apt-get update && sudo apt-get upgradeIt these commands don't work above.
You have to use
apt-get -u dist-upgrade
Enforce the package update the last version, and auto process the dependent package issue.
If you also have python error
requires Vim compiled with Python (2.6+ or 3.3+) support
You can use
sudo apt-get install vim-nox
The vim will support the python with newest version
8.语系设置
When I run perl, I get the warning:
perl: warning: Setting locale failed.perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8"are supported and installed on your system.perl: warning: Falling back to the standard locale ("C").
export LC_CTYPE=en_US.UTF-8export LC_ALL=en_US.UTF-8
加入到~/.bashrc
9.登录微信平台
views.py
#-*- coding:utf-8 -*-import sysreload(sys)sys.setdefaultencoding('utf8')from django.http.response import HttpResponse, HttpResponseBadRequestfrom django.views.decorators.csrf import csrf_exemptfrom wechat_sdk import WechatConffrom wechat_sdk import WechatBasicfrom wechat_sdk.exceptions import ParseErrorfrom wechat_sdk.messages import (TextMessage, VoiceMessage, ImageMessage, VideoMessage, LinkMessage, LocationMessage, EventMessage, ShortVideoMessage)conf = WechatConf( token='YOUR_TOKEN_HERE', appid='YOUR_APPID', appsecret='YOUR_APPSECRET', encrypt_mode='YOUR_MODE', encoding_aes_key='YOUR_AES_KEY')@csrf_exemptdef wechat_home(request): signature = request.GET.get('signature') timestamp = request.GET.get('timestamp') nonce = request.GET.get('nonce') wechat_instance = WechatBasic(conf=conf) if not wechat_instance.check_signature(signature=signature, timestamp=timestamp, nonce=nonce): return HttpResponseBadRequest('Verify Failed') else: if request.method == 'GET': response = request.GET.get('echostr', 'error') else: try: wechat_instance.parse_data(request.body) message = wechat_instance.get_message() if isinstance(message, TextMessage): reply_text = 'text' elif isinstance(message, VoiceMessage): reply_text = 'voice' elif isinstance(message, ImageMessage): reply_text = 'image' elif isinstance(message, LinkMessage): reply_text = 'link' elif isinstance(message, LocationMessage): reply_text = 'location' elif isinstance(message, VideoMessage): reply_text = 'video' elif isinstance(message, ShortVideoMessage): reply_text = 'shortvideo' else: reply_text = 'other' response = wechat_instance.response_text(content=reply_text) except ParseError: return HttpResponseBadRequest('Invalid XML Data') return HttpResponse(response, content_type="application/xml")urls.py
urlpatterns = [ url(r'^wechat/', views.wechat_home),]
微信后台配置
自定义菜单:自定义链接:需要公众号认证
订阅号无法认证
只有服务号和企业号可以认证。
10. docker的使用
0 0
- ECS使用及环境配置
- 如何在ecs上面配置php环境
- seleniumRC环境配置及使用
- ECS Linux服务器安装JDK配置JAVA环境
- 阿里云ECS服务器php运行环境配置全过程
- 阿里云ECS服务器php运行环境配置全过程
- BDI2000配置及使用环境小记
- Maven环境配置及使用心得
- CocoaPods介绍及环境配置和使用
- picasso-基本使用及环境配置
- notepad++使用及配置C语言环境
- 阿里云ECS服务器Linux环境下配置php运行环境(安装配置篇)
- 阿里云ECS服务器Linux环境下配置php运行环境(安装配置篇)
- 阿里云ECS服务器配置LAMP使用IP地址无法访问
- 阿里云ECS配置
- ECS配置Docker-swarm
- 阿里云ECS使用
- 服务端ecs使用mongodb
- App开发:模拟服务器数据接口
- Oracle存储过程和存储函数
- Binder通信机制
- Oracle结构化(PL/SQL)
- VC注释宏
- ECS使用及环境配置
- sql server锁知识及锁应用
- ORACLE 索引
- Saltstack自动部署Haproxy+keepalived+nginx+memcache+php(fastcgi)
- Rsync+Sersync实时同步
- 机器学习 cs229学习笔记6(增强学习 reinforcement learning,MDP)
- Oracle Select查询语句
- Eclipse is running in a JRE, but a JDK is required
- [LeetCode] 467. Unique Substrings in Wraparound String 解题报告