2013-05-10 74 views
0

了Apache的基本配置爲:apache和mod_python的基本配置有什麼問題?

LoadModule python_module /usr/lib64/httpd/modules/mod_python.so 
<Location "/mysite/"> 
     SetHandler python-program 
     PythonHandler django.core.handlers.modpython 
     SetEnv DJANGO_SETTINGS_MODULE mysite.settings 
     PythonOption django.root /mysite 
     PythonDebug On 
     PythonPath "['/var/www/html', '/usr/local/gdnsplus_conf/www/mysite'] + sys.path" 
</Location> 

我做:

ln -sf /usr/local/gdnsplus_conf/www/mysite /var/www/html/gdnsplus_conf 

的Django的版本:1.4.5
mod_python的版本是:3.3.1
django應用程序的目錄是:/ usr/local/gdnsplus_conf/www/mysite
應用程序的上下文是:

ll /usr/local/gdnsplus_conf/www/mysite 
total 184 
-rw-r--r-- 1 apache root 2970 Mar 25 16:20 conf.xml 
-rw-r--r-- 1 apache root 4992 Apr 25 17:15 cv 
-rw-r--r-- 1 apache root 4991 Apr 25 17:16 cv_all 
-rw-r--r-- 1 apache root 6727 Mar 29 18:05 hand_xml.py 
-rw-r--r-- 1 apache root  0 Mar 12 09:12 __init__.py 
-rw-r--r-- 1 apache root 134 Mar 12 09:15 __init__.pyc 
-rw-r--r-- 1 apache root 5720 Apr 17 15:27 settings.py 
-rw-r--r-- 1 apache root 5400 Mar 12 09:33 settings.py.bk 
-rw-r--r-- 1 apache root 3118 Apr 17 15:27 settings.pyc 
-rw-r--r-- 1 apache root 2080 Apr 22 13:34 tags 
drwxr-xr-x 2 apache root 4096 May 9 13:46 templates 
-rw-r--r-- 1 apache root 62 Apr 27 11:05 test 
-rw-r--r-- 1 apache root 1238 May 9 11:09 urls.py 
-rw-r--r-- 1 apache root 1144 May 9 11:10 urls.pyc 
-rw-r--r-- 1 apache root 34352 May 9 13:45 views.py 
-rw-r--r-- 1 apache root 30384 Apr 16 09:06 views.py.bk 
-rw-r--r-- 1 apache root 33425 May 9 14:55 views.pyc 
-rw-r--r-- 1 apache root 1134 Mar 12 09:12 wsgi.py 
-rw-r--r-- 1 apache root 1028 Mar 12 09:15 wsgi.pyc 

urls.py的信息來源是:

urlpatterns = patterns('', 
     (r'^conf_xml/$', receive), 
     (r'^dc_list/$', listall), 
     (r'^show_err/$', show_err), 
     (r'^ipdb_file/$', ipdb_file), 
     (r'^ipdb_update/$', ipdb_update), 
     (r'^task_list/$', task_list), 
     (r'^task_search/$', task_search), 
     (r'^nip_set/$', nip_set), 
     (r'^nip_del/$', nip_del), 
     (r'^nip_update/$', nip_update), 
     (r'^ns_set/$', ns_set), 
     (r'^ns_list/$', ns_list), 
     (r'^reversion_list/$', list_version), 
     (r'^version_set/$', version_set), 
     (r'^index/$', all_err), 
     (r'^machine/$', show_machine), 

的問題是:

http://192.168.23.73/ns_list/ 

不work.The錯誤消息從Apache日誌 「文件不存在」。

如何解決?謝謝。

+0

不應該以'http:// 192.168.23.73/mysite/ns_list /'的身份訪問嗎? – Rohan 2013-05-10 06:42:38

+0

@Rohan PythonOption django.root/mysite所以,不需要mysite – lxgeek 2013-05-10 06:57:34

回答

0

您應該按照Rohan在評論中所述在http://192.168.23.73/mysite/ns_list/訪問。

這是因爲Apache的配置,你有<Location "/mysite/">

你可以閱讀更多有關location directive here。從該文檔:

在下面的例子,其中使用尾隨斜線,請求到 /private2 /和/private2/file.txt將具有封閉的指令施加 ,但/ private2和/ private2other將不。

<Location /private2/> 
    # ... 
</Location> 

另外值得一提的是,mod_python不再正在積極發展,你或許應該看看使用modwsgi代替。

+0

謝謝。我選擇使用wsgi。 – lxgeek 2013-05-10 08:58:02