zoukankan      html  css  js  c++  java
  • 服务器部署django+uwsgi+nginx项目全过程整理

    1. 安装python
    #安装python3.6
    $ sudo apt-get install software-properties-common
    $ sudo add-apt-repository ppa:deadsnakes/ppa
    $ sudo apt-get update
    $ sudo apt-get install python3.6
    
    #
    修改默认Python版本
    > 先查看系统中有那些Python版本:
    ls /usr/bin/python*
    > 先删除默认的Python软链接:
    sudo rm /usr/bin/python
    > 创建一个新的软链接指向需要的Python版本
    sudo ln -s /usr/bin/python3.6 /usr/bin/python
    
    #提升python3优先级
    //将3.7安装之前电脑自带的3.x 优先级降为1
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 1
    //提升3.7优先级为2
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
    
    <--------------------------------------------------------------------------------->
    //python2优先级降低
    sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
    //python3优先级提升
    sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
    
    1. 安装mysql
    1. 安装mysql
    sudo apt-get install mysql-server mysql-client
    2. 测试是否安装成功
    sudo netstat -tap | grep mysql
    3. vi /etc/mysql/mysql.conf.d/mysqld.cnf
    #找到将bind-address = 127.0.0.1注销​
    #bind-address            = 127.0.0.1
    4.修改后,重启mysql
    sudo /etc/init.d/mysql restart
    5. 登录
    重新登录mysql -uroot -p
    grant all privileges on *.* to 'root'@'%' identified by '密码';
    flush privileges;
    6.将字符编码设置为UTF-8
    默认情况下,MySQL的字符集是latin1,因此在存储中文的时候,会出现乱码的情况,所以我们需要把字符集统一改成UTF-8。
    打开mysql配置文件
    vi /etc/mysql/mysql.conf.d/mysqld.cnf
    a) 打开mysql配置文件:
    
                    vi /etc/mysql/mysql.conf.d/mysqld.cnf
    b) 在[client]下追加:
    
                    default-character-set=utf8
    c) 在[mysqld]下追加:
    
                    character-set-server=utf8
    d) 在[mysql]下追加:
    
                    default-character-set=utf8
    
    修改后,重启MySQL服务器,并登录
    mysql -uroot -p
    
    再次查看字符串编码是否正确
    
    1. 安装redis
    $ sudo apt update
    $ sudo apt install redis-server
    
    sudo vi /etc/redis/redis.conf
    $ sudo service redis restart
    sudo systemctl status redis
    启动:
    $ redis-cli
    
  • 相关阅读:
    fastjson基本使用 (待继续完善)【原】
    webkit内核浏览器的CSS写法
    sencha touch pull-refresh-panel 面板下拉刷新
    一个非常棒的星星评分插件
    JavaScript字符转Unicode,顺便说句:GitHub的Oh no页面很亮
    Git版本控制软件结合GitHub从入门到精通常用命令学习手册
    手把手教你如何加入到github的开源世界!
    前端面试题:高效地随机选取数组中的元素
    CSS3 动画animation
    CSS3 Transform
  • 原文地址:https://www.cnblogs.com/plusUltra/p/12925202.html
Copyright © 2011-2022 走看看