python django nginx从零开始搭建一个web网站系列1
2016-09-02 18:54
706 查看
买了个vps
系统之前是centos7,发现太素了,换成了ubuntu
ubuntu自带python3 以及python2
系统没有pip3
如提示,apt-get install python3-pip
即可装好pip3
然后指定安装django1.8.1版本
pip3 install django==1.8.1
即可
然后查看uwsgi
提示这样
选一个python3的版本
apt-get install uwsgi-plugin-python3
然后写个 test.py文件
#test.py
def application(env, start_response):
tart_response('200 ok', [('Content-Type','text/html')])
return [b'Hello Word']
注意 好多教程都是python2的,在python3里面是return [b"Hello word"]
然后起服务,uwsgi --http :8001 --wsgi-file /root/OBJ/atom/test.py
报错
“
uwsgi: option '--http' is ambiguous; possibilities: '--http-socket' '--http-socket-modifier2' '--http-socket-modifier1'getopt_long() error
”
root@cloud:~/OBJ/atom# uwsgi --http :8001 --wsgi-file /root/OBJ/atom/test.py
uwsgi: option '--http' is ambiguous; possibilities: '--http-socket' '--http-socket-modifier2' '--http-socket-modifier1'
getopt_long() error
加上-socket
root@cloud:~/OBJ/atom# uwsgi --http-socket :8001 --wsgi-file /root/OBJ/atom/test.py
uwsgi: unrecognized option '--wsgi-file'
getopt_long() error
再加
root@cloud:~/OBJ/atom# uwsgi --http :8001 --wsgi-file /root/OBJ/atom/test.py
OK 测试程序跑通
因为ubuntu没有防火墙,可以直接访问,若是其他系统,访问不了的话,请自行判断是否需要关闭防火墙
系统之前是centos7,发现太素了,换成了ubuntu
ubuntu自带python3 以及python2
系统没有pip3
如提示,apt-get install python3-pip
即可装好pip3
然后指定安装django1.8.1版本
pip3 install django==1.8.1
即可
然后查看uwsgi
提示这样
选一个python3的版本
apt-get install uwsgi-plugin-python3
然后写个 test.py文件
#test.py
def application(env, start_response):
tart_response('200 ok', [('Content-Type','text/html')])
return [b'Hello Word']
注意 好多教程都是python2的,在python3里面是return [b"Hello word"]
然后起服务,uwsgi --http :8001 --wsgi-file /root/OBJ/atom/test.py
报错
“
uwsgi: option '--http' is ambiguous; possibilities: '--http-socket' '--http-socket-modifier2' '--http-socket-modifier1'getopt_long() error
”
root@cloud:~/OBJ/atom# uwsgi --http :8001 --wsgi-file /root/OBJ/atom/test.py
uwsgi: option '--http' is ambiguous; possibilities: '--http-socket' '--http-socket-modifier2' '--http-socket-modifier1'
getopt_long() error
加上-socket
root@cloud:~/OBJ/atom# uwsgi --http-socket :8001 --wsgi-file /root/OBJ/atom/test.py
uwsgi: unrecognized option '--wsgi-file'
getopt_long() error
再加
root@cloud:~/OBJ/atom# uwsgi --http :8001 --wsgi-file /root/OBJ/atom/test.py
OK 测试程序跑通
因为ubuntu没有防火墙,可以直接访问,若是其他系统,访问不了的话,请自行判断是否需要关闭防火墙
相关文章推荐
- Django从零开始搭建一个相册网站--5.Python操作数据库
- Django从零开始搭建一个相册网站--2.建站
- Django从零开始搭建一个相册网站--3.基本视图映射
- 从零开始搭建个人网站(7)nginx+uWSGI部署Django项目(下)
- 从零开始搭建个人网站(6)nginx+uWSGI部署Django项目(上)
- Django从零开始搭建一个相册网站--1.序
- Ubuntu+Django+Nginx+uWSGI+Mysql搭建Python Web服务器
- 搭建python的web环境 Centos5.4+Nginx-0.8.50+UWSGI-0.9.6.2+Django-1.2.3搭建高性能WEB服务器环境
- Nginx+uwsgi+Django 搭建一个简单的web服务器
- CentOS + Python3.6+ Django2.0 + uwsgi + nginx + mysql web发布环境搭建
- Django从零开始搭建一个相册网站--6.取数据
- python3.x +django + nginx + uwsgi 搭建web服务
- Django从零开始搭建一个相册网站--4.models
- linux下搭建nginx,uwsgi和python的flask和django网站
- Ubuntu+Django+Nginx+uWSGI+Mysql搭建Python Web服务器
- 30分钟搭建一个小型网站框架(python django)
- CentOS + Python3.3 + Django1.7 + uwsgi + nginx + mysql web发布环境搭建
- Nginx+uWSGI+Django+Python+ MySQL 搭建可靠的Python Web服务器
- virtualenv 环境下 Django + Nginx + Gunicorn+ Supervisor 搭建 Python Web
- Nginx+uWSGI+DJango+Python+ Mysql 搭建可靠的python web服务