因为我可以显示文件" .py"在阿帕奇

时间:2014-08-16 18:03:57

标签: python apache

我尝试通过浏览器显示多个文件但不能。我的项目的Estructuta如下:

Python
   |___App
   |    |___Logs
   |    |___Application.wsgi
   |
   |____Public
        |___Index.py

Application.wsgi

# -*- coding: utf-8 *-*
import os, sys
sys.path.append('/var/www/python/app')
def application(environ, start_response):
    output = "Hello world!"
    start_response('200 OK', 
                   [('Content-Type', 
                     'text/html; charset=utf-8')])
    return output

Index.py

name = "John M."
years = 25
print name "<br>"
print years

/etc/apache2/sites-available/pythonapps.conf

    <VirtualHost *:80>
    ServerName pythonapps

    DocumentRoot /var/www/python/public
    WSGIScriptAlias / /var/www/python/app/application.wsgi
    ErrorLog /var/www/python/app/logs/py_errors.log
    CustomLog /var/www/python/app/logs/py_access.log combined

    <Directory /var/www/python/public>
        Options FollowSymLinks
AddHandler mod_python .py
        AllowOverride All
    </Directory>
</VirtualHost>

问题是他们总是告诉我&#34;你好世界&#34;并希望通过http://zendapps/index.py来显示其他文件。我能做什么?

0 个答案:

没有答案