django static + apache mod_wsgi部署
2016-05-16 16:46
489 查看
0.基本配置
/path/to/mysite.com/是项目路径。替换成实际的就好了。WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py WSGIPythonPath /path/to/mysite.com <Directory /path/to/mysite.com/mysite> <Files wsgi.py> Require all granted </Files> </Directory>
另外如果你用apache2.2,那么需要改Require语法。
<Files wsgi.py> Allow from all Order deny,allow </Files>
1.静态文件
在setting.py文件中定义STATIC_ROOTSTATIC_ROOT = "/var/www/example.com/static/"
生成静态文件
python manage.py collectstatic
然后用apache的Alias就可以了。
Alias /media/ /path/to/mysite.com/media/ Alias /static/ /path/to/mysite.com/static/
相关文章推荐
- 开源许可证GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
- loadrunner不能添加Apache监控
- hadoop入门第七步---hive部署安装(apache-hive-1.1.0)
- LINUX+APACHE+MYSQL+PHP安全加固配置说明
- apache配置相关
- Apache相关配置
- apache (0xc000007b) 错误
- PHP7 + Apache2.4 + MySQL 5.7 + Windows7
- Apache Commons包含了很多开源的工具类介绍
- apache-commons-stringutil的常用使用方法
- Apache ActiveMQ启动DEMO错误
- apache基于端口的虚拟主机配置
- apache2.4.7虚拟机配置多域名(其中一个是二级域名)
- windows apache2.4 基于主机名的虚拟主机配置
- Apache日志分割脚本
- 解决apache日志产生"internal dummy connection"方法
- apache安装(适用于初学者)
- Spark-再次分析Apache访问日志
- 利用Apache Ant编译Hadoop2.6.0-eclipse-plugin
- Apache Flink源码解析之stream-transformation