ls -lha

export WORKON_HOME=~/venv
source /usr/local/bin/vitualenvwrapper.sh
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

安装python3

apt-get update
sudo apt-get install python3-dev build-essential libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev
sudo apt-get install python3
sudo apt-get install python3-pip

1.什么是服务器?

激活虚拟环境:

sudo pip3 install virtualenv
sudo pip3 install virtualenvwrapper
source bin/activate pip3 install django==1.11.6 django-admin startproject smartkidz
python3 manage.py startapp api

关闭虚拟环境:

deactivate
pip freeze

pip freeze > req.txt

pip3 install -r req.txt

sudo apt-get install libmysqlclient-dev

pip install mysqlclient

安装数据库

sudo apt-get install mysql-server
进入数据库创建自己的账户并给分配所有的权限,并且刷新权限,在配置文件当中bind 0.0.0.0 python3 manage.py runserver

部署上线uwsgi的安装及测试

安装uwsgi
pip3 install uwsgi -i https://pypi.douban.com/simple/ 测试
uwsgi --http :8000 --module GuLiEdu.wsgi 安装配置nginx
sudo apt-get install nginx smartkidz_nginx.conf # the upstream component nginx needs to connect to
upstream django {
# server uninx:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8000; # for a web port socket (we'll use this first)
}
#configuration of the server server {
#the port your site will be served on
listen 80;
#the domain name it will serve for
server_name 47.106.224.45;
charset utf8; #max upload size
client_max_body_size 75M; location /static {
alias /home/smartkidz/smartkidz/static;
}
location /{
uwsgi_pass django;
include /etc/nginx/uwsgi_params;
}
} 将该配置文件加入到nginx的启动配置文件夹中
sudo cp smrtkidz_nginx.conf /etc/nginx/conf.d/ python3 manage.py collectstatic sudo service nginx restart ps -aux|grep nginx # ite_uwsgi.ini file
[uwsgi] # Django-related settings
# the base directory (full path)
chdir = /home/python/smartkidz/
# Django's wsgi file
module = smartkidz.wsgi
# the virtualenv(full path)
# process-related settings
#master
master = true
process = 10
socket = 127.0.0.1:8000
vacuum = true
virtualenv = /home/venv
logto = /tmp/mylog.log uwsgi -d -i uwsgi.ini sudo netstat -antup
sudo kill 7358

最新文章

  1. pt-query-digest使用介绍【转】
  2. for循环练习
  3. 安全关闭多Activity的Application
  4. (转)priority_queue的用法
  5. VS中使用系统的环境变量作为INCLUDE和LIBPATH的值
  6. linux服务器挂载第二块磁盘图文解说
  7. 310. Minimum Height Trees
  8. mysql 增加用户
  9. [转] 利用任务计划重启sqlserver服务
  10. ERP 能够做什么
  11. linux 脚本编写基础(一)
  12. 关于NIOS ii烧写的几种方式(转)
  13. git 入门教程之里程碑式标签
  14. 使用keytool自建证书及应用
  15. Python——反射
  16. 大佬带你深入浅出Lua虚拟机
  17. Apache2启动错误Could not reliably determine the server's fully qualified domain name
  18. Swift网络封装库Moya中文手册之Targets
  19. 20162314 Experiment 1: Linear structure - experiment report.
  20. uoj50【UR#3】链式反应

热门文章

  1. c语言实现名值对通过key查找value
  2. 时间复杂度big-O、Big-Omega和big-Theta
  3. Zookeeper内部实现分布式数据一致性(底层系统模型)(一)
  4. FreeSql (十二)更新数据时指定列
  5. ACM团队周赛题解(2)
  6. TestNG(十五)xml文件实现多线程测试
  7. .NET Core 获取请求类容(body)
  8. [VB.NET Tips]VB.NET专有的字符串处理函数
  9. Linux初识之Centos7中terminal光标位置偏移问题的解决
  10. 使用docker安装mysql并连接