美文网首页
Django部署

Django部署

作者: 涉世之初 | 来源:发表于2017-04-07 10:01 被阅读26次

新装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

<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

相关文章

网友评论

      本文标题:Django部署

      本文链接:https://www.haomeiwen.com/subject/ebocattx.html