简体   繁体   English

Hello World Python应用程序出现“内部服务器错误”

[英]“Internal Server Error” with Hello World Python App

My files are as follows: 我的文件如下:

application.wsgi ( NOTE: updated as recommended from my previous question here ) application.wsgi( 注意:根据我之前的问题在此处建议进行更新)

import os
import sys


sys.path.append('/srv/www/mysite.com/application')

os.environ['PYTHON_EGG_CACHE'] = '/srv/www/mysite.com/.python-egg'

import flaskr.helloworld
application = flaskr.helloworld.app

helloworld.py helloworld.py

from flask import Flask
app = Flask(__name__)

@app.route('/')
def __init__(self):
    print 'Hello World!'

if __name__ == '__main__':
    app.run()

For what ever reason I get the following error when attempting to load. 无论出于何种原因,在尝试加载时都会出现以下错误。 Nothing is added to my error.log, it just displays this in the browser: "Internal Server Error" 什么也没有添加到我的error.log中,它仅在浏览器中显示:“内部服务器错误”

Change print 'Hello World!' 更改print 'Hello World!' to return 'Hello World!' return 'Hello World!'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM