“Internal Server Error” with Hello World Python App

断了今生、忘了曾经 提交于 2019-12-11 01:38:53

问题


My files are as follows:

application.wsgi (NOTE: updated as recommended from my previous question here)

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

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"


回答1:


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



来源:https://stackoverflow.com/questions/8713794/internal-server-error-with-hello-world-python-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!