新装ubuntu操作系统
更新源sudo apt update 更新软件 sudo apt dist-upgrade
安装 mysql 修改编码
sudo apt-get install mysql-server
sudo apt-get install mysql-client
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
<VirtualHost *:80>
ServerName www.qqcontact.cn
ServerAlias otherdomain.com
ServerAdmin 805892567@qq.com
Alias /media/ /var/www/html/LibraryManagement/media/
Alias /static/ /var/www/html/LibraryManagement/management/static/
<Directory /var/www/html/LibraryManagement/management/static/
Require all granted
</Directory>
WSGIScriptAlias / /var/www/html/LibraryManagement/LM/wsgi.py
<Directory/var/www/html/LibraryManagement/LM/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
更改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