Deploy Django in Apache in Ubuntu 17.10
2017-12-19 17:20
316 查看
Configuration
python: 3.6.3django: 2.0.1
ubuntu: 17.10
Deploy django step by step
VirtualHostvim /etc/apache2/sites-available/sitename.conf
<VirtualHost *:80> ServerName 10.245.36.112 #ServerName localhost #ServerAlias 10.245.36.112 ServerAlias localhost ServerAdmin hans@xxx.com Alias /static/ /var/www/my/static/ <Directory /var/www/my/static> Require all granted </Directory> WSGIScriptAlias / /var/www/my/my/wsgi.py <Directory /var/www/my/my> <Files wsgi.py> Require all granted </Files> </Directory> </VirtualHost>
wsgi.py
vim /var/www/my/my/wsgi.py
import os,sys from django.core.wsgi import get_wsgi_application from os.path import join,dirname,abspath PROJECT_DIR = dirname(dirname(abspath(__file__))) sys.path.insert(0,PROJECT_DIR) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my.settings") application = get_wsgi_application()
enable sitename.conf and apache2
a2ensite sitename.conf a2dissite sitename.conf systemctl reload apache2
Test
相关文章推荐
- Ubuntu16.04下Apache2.4部署Django1.8.7
- Apache mod_proxy in Ubuntu
- GOOD article Ubuntu 10.04 下django 部署到apache服务器 - webdancer's Blog
- django在ubuntu下apache中部署
- How to setup django, python environment in ubuntu
- Ubuntu Apache Invalid URI in request /x13BitTorrent protocolex
- Ubuntu+Django+mod_wsgi+Apache配置过程
- 阿里云部署django Ubuntu 12.04.5 + Apache2.2 + django1.8
- ubuntu下安装apache2.2+mod_wsgi+django(一)
- ubuntu+django+apache+mod_wgsi部署
- Ubuntu 12.04使用Django + apache + mysql 开发web应用(一)
- ubuntu 安装 apache2.2+mod_wsgi+Django
- ubuntu10.04 python django apache mysql mod_python python_mysql
- Ubuntu 13.04 Django 项目部署Apache +WSGI.
- Deploy Jenkins in Ubuntu 16.04
- Ubuntu配置Django和apache+mod_pyth
- Ubuntu 9.10+ apache2.2 +Django的配置
- 手把手教你:Ubuntu+django+apache下配置网页错误OperationalError: Unable to Open Database File 的解决方法
- ubuntu下django和apache的部署
- ubuntu下配置django+apache+mysql+mod_python+Python