pip3.5 install --upgrade pip
安裝好centos
解壓
tar zxvf python-3.5.1.tgz
安裝依賴包
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel python-devel mysql-devel gcc make
安裝python
./configure
make #編譯源** 生成庫檔案
make install
python3.5.1已經安裝好
更改系統預設python為3.5.1
cd /usr/bin
mv python python.bak #備份原有python可執行檔案
which python3.5
ln /usr/local/bin/python3.5 python 將3.5的鏈結過來
公升級pip
pip3.5 install --upgrade pip
安裝mysql
centos下yum暫時沒有mysql-server直接安裝包;
mariadb是mysql社群開發的分支,也是乙個增強型的替代品;
安裝mariadb
yum -y install mariadb-server mariadb mariadb-devel
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
firewall-cmd --permanent --add-service mysql
systemctl restart firewalld.service
iptables -l -n|grep 3306
登入資料庫檢視下是否有變好
msyql -uroot -p
show databases;
create database blog_db charset=utf8;
grant all on *.* to valex@localhost identified by 』kylie『; #建立使用者valex
set password for root@localhost=password('kylie');
flush privileges;
安裝 mysqlclient
pip install mysqlclient
安裝 django
pip install django==1.8.3
#建立django專案
cd /home/valex
django-admin startproject prj1
配置專案資料庫
databases =
}
定位到manage.py所在目錄
$python manage.py migrate
$python manage.py runserver 0.0.0.0:8080
瀏覽器開啟 localhost:8080
it worked!
Django專案部署
專案部署 1 獲取專案開發時的環境 pip freeze plist.txt2 建立python虛擬環境 sudo apt get install python virtualenv python setuptools包裡的乙個命令,所以只要安裝python setuptools就可以了。sudo ...
Django專案部署
django專案部署 settings.py allowed hosts 伺服器ip python manage.py runserver 0.0.0.0 8001 django遵循的wsgi協議 wsgiref效能低 正式部署採用uwsgi,效能較高 pip3 install uwsgi wsgi...
Django專案部署上線
包壓縮技巧 zip unzip linux 下的zip檔案的壓包和解包命令 tar cjvf python3.6 env.tar.bz2 python3.6 env tar xjvf python3.6 env.tar.bz2 一。壓縮拷貝 1 進入工程主目錄 cd shdjangolesson 2...