大哥哪位知道,最近在虚拟机上想配置apache2 上的django时提示mod_python error本地服务器遇到的问题?
我是根据论坛上的文章来安装的在ubuntu 下配置Django和apache mod-python在www.djangoproject.org
下载django 1.1.1版本http://www.djangoproject.com/download/
然后tar xzvf Django-1.1.1.tar.gzcd Django-1.1.1sudo python setup.py install接下来你进入到刚才所解压的django/bin目录下,运行python django-admin.py startproject myproject,他将会在你的bin目录下创建myproject目录,myproject/__init__.pymanage.pysettings.pyurls.py这时候你需要修改一下settings.pyDATABASE_ENGINE = 'mysql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.DATABASE_NAME = 'django' # Or path to database file if using sqlite3.DATABASE_USER = 'root' # Not used with sqlite3.DATABASE_PASSWORD = '' # Not used with sqlite3.DATABASE_HOST = 'localhost' # Set to empty string for localhost. Not used with sqlite3.DATABASE_PORT = '3306' # Set to empty string for default. Not used with sqlite3.按照你的不同情况设定不同的参数然后我把这个目录复制到/var/www/mydjango/下python manage.py runserverValidating models...0 errors found.Starting server on port 8000 with settings module 'myproject.settings'.Go to http://127.0.0.1:8000/
for Django.Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows).你也可以通过指定端口的方式运行python manage.py runserver 8080到浏览器中访问一下吧 到这个地方法都没有问题 你需要准备libapache2-mod-python 和 python-mysqldb然后sudo gedit /etc/apach2/site-available/default添加<Directory "/var/www/mydjango/myproject/"}>SetHandler python-programPythonPath "['/var/www/mydjango/myproject/'] + sys.path"PythonHandler django.core.handlers.modpythonSetEnv DJANGO_SETTINGS_MODULE djangotest.settingsPythonDebug OnOptions FollowSymLinksAllowOverride all</Directory>这时候只要你sudo /etc/init.d/apache2 restart然后去浏览器中输入http://localhost/mydjango/myproject
在这里就提示mod_python error但是安装完成以后出现了以下的错误信息:/etc/apache2/sites-available# sudo /etc/init.d/apache2 restartapache2: Syntax error on line 203 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/mods-enabled/mod-python.load: No such file or directoryAction 'configtest' failed.The Apache error log may have more information. ...fail!希望linux大侠帮帮忙啊,小弟实在是无法解决了~