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:
本文探讨了在使用Django框架时遇到数据库文件为readonly错误的原因,并提供了通过修改目录权限解决问题的方法。
1793

被折叠的 条评论
为什么被折叠?



