Django部署

新装ubuntu操作系统

更新源sudo apt update 更新软件 sudo apt dist-upgrade

安装 mysql 修改编码

  1. sudo apt-get install mysql-server

  2. sudo apt-get install mysql-client

  3. sudo apt-get install libmysqlclient-dev

安装并更新pip sudo apt install python-pip sudo pip install --upgrade pip
安装Django sudo pip install Django
安装Pillow 安装依赖 sudo apt install libjpeg8-dev zlib1g-dev libfreetype6-dev
sudo pip install Pillow

Apache部署Django

sudo vim /etc/apache2/sites-available/LM.conf

ServerName www.qqcontact.cn

ServerAlias otherdomain.com

ServerAdmin [email protected]

Alias /media/ /var/www/html/LibraryManagement/media/

Alias /static/ /var/www/html/LibraryManagement/management/static/

Require all granted

WSGIScriptAlias / /var/www/html/LibraryManagement/LM/wsgi.py



Require all granted

更改settings.py
sudo vim settings.py

sudo a2ensite LM.conf

sudo vim /var/www/html/LibraryManagement/LM/wsgi.py
sudo vim /var/www/html/LibraryManagement/LM/settings.py

sudo service apache2 restart
sudo vim /etc/apache2/sites-available/LM.conf

你可能感兴趣的:(Django部署)