标签:shell
软件都安装运行在windows上,版本如下:
mod_wsgi-3.5.ap24.win32-py2.7.zip
httpd-2.4.10-win32-VC11.zip
安装apache
windows安装apache2.4参考http://blog.csdn.net/zwfcan/article/details/8173838(windows安装PHP5.4+Apache2.4+Mysql5.5)
安装mod_wsgi
参考http://www.cnblogs.com/fnng/p/4119712.html(Apache部署django项目)
配置apache和django项目
我的django项目目录:D:\www\myweb
拷贝一份www
按照参考文章配置myweb/wsgi.py文件时:
…… import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
一直报错“ImportError: Could not import settings ‘myweb.settings‘ (Is it on sys.path? Is there an import error in the settings file?): No module named myweb.settings”,google了一下众说纷纭,最后修改如下才正常:
import os,sys #os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings") path = ‘D:\www‘ if path not in sys.path: sys.path.insert(0, ‘D:\www‘) os.environ["DJANGO_SETTINGS_MODULE"] = "myweb.settings" from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
标签:shell
原文地址:http://dragonball.blog.51cto.com/1459915/1599077