Centos7&Python2.7&django&uwsgi&mariadb&python虚拟环境
2017-10-16 17:49
483 查看
先设置Python 环境变量 否则容易出错
1.安装、升级pip
先安装epel源
2.安装配置django
3.安装mysql、uwsgi
wsgi配置文件
在/etc/下建立uwsgi8008.ini文件
nginx配置文件
/etc/nginx/de
4000
fault.d/8008.conf
1.安装、升级pip
先安装epel源
yum -y install epel-release yum -y install python-pip pip install --upgrade pip
2.安装配置django
pip install django
3.安装mysql、uwsgi
yum -y install mariadb mariadb-server yum -y install MySQL-python mariadb-devel **yum -y install python-devel #不安装此包 uwsgi会报错** pip isntall uwsgi #测试uwsgi touch test.py 1 # test.py 2 def application(env, start_response): 3 start_response('200 OK', [('Content-Type','text/html')]) 4 return "Hello World" uwsgi --http :8080 --chdir /home/mysite -w mysite.wsgi #测试wsgi是否正常运行
django-admin startproject mytest uwsgi --http :80 --chdir /home/mytest --module mytest.wsgi #测试django
wsgi配置文件
在/etc/下建立uwsgi8008.ini文件
1 [uwsgi] 2 #socket=/home/qian/django.sock 3 socket=192.168.37.128:8889 4 chdir =/home/qian/qian 5 wsgi-file=qian/wsgi.py 6 processes=4 7 threads=2 8 stats=192.168.37.128:9191
nginx配置文件
/etc/nginx/de
4000
fault.d/8008.conf
#mysite_nginx.conf # the upstream component nginx needs to connect to upstream django { # server unix:///path/to/your/mysite/mysite.sock; # for a file socket server 192.168.37.128:8889; # 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 192.168.37.128; # substitute your machine's IP address or FQDN charset utf-8; # max upload size client_max_body_size 75M; # adjust to taste # Django media location /media { alias /home/qian/media; # your Django project's media files - amend as required } location /static { alias /home/qian/static; # your Django project's static files - amend as required } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed } }
python虚拟环境
Virtualenv 安装epel扩展源 yum install epel-release 安装pip yum install python-pip 安装virtualenv和virtualenvwrapper pip install virtualenv virtualenvwrapper 编辑~/.bashrc文件,结尾添加以下内容 export WORKON_HOME=~/.virtualenvs source /usr/bin/virtualenvwrapper.sh 然后执行以下命令使配置生效 source ~/.bashrc 创建env mkvirtualenv explame 使用pip安装项目需要的包
相关文章推荐
- python&Django&mariadb&Apache&mod_wsgi 环境部署
- nginx+uwsgi+django+python环境部署文档
- python3环境搭建(uWSGI+django+nginx+python+MySQL)
- Nginx+Python+uwsgi+Django的web开发环境安装及配置
- Nginx+uwsgi+Django (Python web环境)
- DJango-如何快速准备Python虚拟开发环境并快速定制一个项目
- 搭建python的web环境 Centos5.4+Nginx-0.8.50+UWSGI-0.9.6.2+Django-1.2.3搭建高性能WEB服务器环境
- §第一天§简单介绍一下Python的安装与开发环境的搭建
- CentOS7 :Apache + Python3.6(虚拟环境)+ Django 部署网站
- Python虚拟环境之Anaconda&virtualenv
- Centos + Python3.5 + pip + uwsgi + django环境搭建
- ubuntu 下搭建一个python3的虚拟环境(用于django配合postgresql数据库开发)
- Python & PyCharm & Django 搭建web开发环境
- python虚拟环境Django,python-virtualenv安装
- 第四百零一节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署virtualenv虚拟环境安装,与Python虚拟环境批量安装模块
- django 虚拟环境安装mysql-python
- Nginx+Python+uwsgi+Django环境搭建
- 生产环境部署python代码(django+uwsgi+nginx)
- ngnix+uwsgi+python+django环境搭建
- nginx & flup & django & python3.x @ window7配置备忘录