ssh -i /path/to/dymx102 -p 22 root@114.67.130.26
2 安装Python
一、添加epel源
yum install epel-release
二、安装Python3.4,装完再升级吧
yum install python34
三、安装pip3
yum install python34-setuptools
easy_install-3.4 pip
之后就可以使用pip3了,如:
yum search python3 | grep devel
python34-devel.i686 : Libraries and header files needed for Python 3 development
python34-devel.x86_64 : Libraries and header files needed for Python 3
: development
yum install -y unzip zip
yuminstall-ygccgcc-c++
yum search python3 | grep devel
3 安装MysqL
#yum install MysqL
#yum install MysqL-server
#yum install MysqL-devel
MysqL -u root -p
service MysqLd restart
flush privileges;
4 安装jango
pip3 install django
5 安装rest-framework
pip install djangorestframework pip install markdown # Markdown support for the browsable API. pip install django-filter # Filtering support6 安装 uwsgi
pip install uwsgi
配置uwsgi 文件如下。
[uwsgi]
socket = 127.0.0.1:8000
chdir = /workCode/CookBookServer/fsweb
wsgi-file = fsweb/wsgi.py
processes = 1
threads = 1
Nginx 配置
server {
listen 8080;
server_name 192.168.1.117;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
}
location /static {
alias /workCode/CookBookServer/fsweb/fsweb/static;
}
location ~.*\.(gif|jpg|jpeg|png|bmp|swf)$ {
root /workCode/CookBookServer/fsweb/fsweb;
if (-f $request_filename) {
expires 1d;
break;
}
alias /workCode/CookBookServer/fsweb/fsweb/static;
}
location ~.*\.(gif|jpg|jpeg|png|bmp|swf)$ {
root /workCode/CookBookServer/fsweb/fsweb;
if (-f $request_filename) {
expires 1d;
break;
}
}
location ~.*\.(js|css)$ {
root /workCode/jxnx/jxnxweb;
if (-f $request_filename) {
expires 1d;
break;
}
}
7 django 静态化
STATIC_URL = '/static/' STATIC_ROOT = os.path.join(os.path.dirname(__file__),'static') # STATICFILES_DIRS = ( ('css',os.path.join(STATIC_ROOT,'css').replace('\\','/') ),('js','js').replace('\\',('images','images').replace('\\',('upload','upload').replace('\\',)
修改urls.py
urlpatterns += staticfiles_urlpatterns()