How to use Django with Apache and mod_wsgi
来源:互联网 发布:深圳数据分析培训机构 编辑:程序博客网 时间:2024/05/18 02:21
edit httpd.conf
WSGIScriptAlias / /home/liuke/www/django/hello/apache/django.wsgi
add file
django.wsgi
import os
import sys
path = '/home/liuke/www/django/hello'
if path not in sys.path:
sys.path.append(path)
#os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
官方网站上说是os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
这样会出错试了改为settings就可以
or
把path = '/home/liuke/www/django/hello'
改为path = '/home/liuke/www/django'
应该也可以吧
edit setting.py 开头加入
import sys
sys.path.append('/home/liuke/www/django/hello')
sys.path.append('/home/liuke/www/django/')
还有里面的path要是绝对path
sqlite3的数据文件为出现为readonly 的error,
要把数据文件单独放在一个dir里,然后
chown www-data. .
Aha, just stumbled across an article explaining this. Also Django have info on their NewbieMistakes page.
The solution is to make sure the directory containing the database file also has write access allowed to the process.
In my case, running this command fixed the problem:
- How to use Django with Apache and mod_wsgi
- How to use Django with mod_wsgi.
- How to use Django with Apache and mod_python
- How to setup Apache + Python + Django + mod_wsgi
- How to use Django with uWSGI
- Deploying Django with Apache and mod_wsgi Based on Red Hat Enterprise Linux Server
- How to Install and Use JRebel with WebLogic and Eclipse
- How to setup Apache and mod_python and django
- How to use Comparator and Comparable in Java? With example
- How to use SCAN and node listeners with different ports?
- how to use adb and gdbserver with VirtualBox - KVM (qemu)
- apache +mod_wsgi + django deploying
- django apache mod_wsgi配置
- apache+mod_wsgi+django
- How to Setup Apache With FastCGI And Ruby Bindings
- How to configure and use Git with visual studio 2012 and TFS
- How to Use C++ With PHP and JQuery to Make Neat Apps
- apache+django+mod_wsgi 部署实践
- 2011-8-10 20:35:36
- 字符串表示,str 和 repr
- 高校名单:“211”工程大学名单(112所)
- 2011-8-10 21:44:45
- poj 1228 Grandpa's Estate(凸包)
- How to use Django with Apache and mod_wsgi
- poj 1149 : PIGS (网络流,EK模板)
- 2011-8-10 21:49:14
- Bochs常用调试指令
- ExtJS中this.form.el is undefined
- 单机双系统共用svn版本库
- 创新还是抄袭
- iphone开发UITable内嵌不同风格Table
- poj1065 贪心