Ubuntu Apache下部署Django2项目
环境
- ubuntu:18.04
- Apache:2.4.29
- Python:3.6.6
- Django:2.1.3
Python
系统自带Python2.7.15rc以及Python3.6.6安装Apache
sudo apt install apache2 sudo apt install libapache2-mod-wsgi-py3
安装Django
体验Django2,就必须要求是Python3,所以下面都是基于Python3安装pip
sudo apt install python3-pip
安装Django2
sudo pip3 install django这里一定要使用
sudo
,否则,Apache无法import django
修改Apache
文件路劲: /etc/apache2/sites-available/000-default.conf<VirtualHost *:80> ServerName www.example.com ServerAlias example.com ServerAdmin [email protected] #Alias /media/ /home/blog/media/ #Alias /static/ /home/blog/static/ #<Directory /home/blog/media> # Require all granted #</Directory> #<Directory /home/blog/static> # Require all granted #</Directory> WSGIScriptAlias / /home/blog/blog/wsgi.py <Directory /home/blog/geek> <Files wsgi.py> Require all granted </Files> </Directory> </VirtualHost>
重启Apache
sudo service apache2 restart
相关推荐
Kafka 2020-09-18
Wepe0 2020-10-30
杜倩 2020-10-29
windle 2020-10-29
minerd 2020-10-28
mengzuchao 2020-10-22
Junzizhiai 2020-10-10
bxqybxqy 2020-09-30
风之沙城 2020-09-24
kingszelda 2020-09-22
大唐帝国前营 2020-08-18
yixu0 2020-08-17
TangCuYu 2020-08-15
xiaoboliu00 2020-08-15
songshijiazuaa 2020-08-15
xclxcl 2020-08-03
zmzmmf 2020-08-03
newfarhui 2020-08-03
likesyour 2020-08-01