“内部服务器错误”与Hello World Python应用程序 [英] "Internal Server Error" with Hello World Python App

查看:200
本文介绍了“内部服务器错误”与Hello World Python应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文件如下:
$ b 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'

导入flaskr.helloworld
application = flaskr.helloworld.app

helloworld.py

< pre $ from flask import Flask
app = Flask(__ name__)
$ b $ app_route('/')
def __init __(self ):
print'Hello World!'

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

因为什么原因,我试图加载时出现以下错误。什么都没有添加到我的error.log,它只是在浏览器中显示:内部服务器错误

解决方案

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


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"

解决方案

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

这篇关于“内部服务器错误”与Hello World Python应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆