我在网站的某个页面上出现几个小时后收到500内部服务器错误。我用uwsgi --ini /home/metheuser/webapps/ers_portal/ers_portal_uwsgi.ini
重新启动uWSGI实例,它再次工作几个小时。
该网站的其余部分似乎正在运作。当我导航到my_table
时,我会转到login
页面。但是,登录时我在表格页面上出现500
错误。我按照instructions here设置了我的nginx和uwsgi配置。
也就是说,我ers_portal_nginx.conf
位于我的app文件夹中,该文件夹符号链接到/etc/nginx/conf.d/
。我在上面提到的Screen
实例中启动了我的uWSGI“实例”(不确定究竟要调用它),{app}文件夹中有.ini
文件
我的ers_portal_nginx.conf
:
server {
listen 80;
server_name www.mydomain.com;
location / { try_files $uri @app; }
location @app {
include uwsgi_params;
uwsgi_pass unix:/home/metheuser/webapps/ers_portal/run_web_uwsgi.sock;
}
}
我的ers_portal_uwsgi.ini
:
[uwsgi]
#user info
uid = metheuser
gid = ers_group
#application's base folder
base = /home/metheuser/webapps/ers_portal
#python module to import
app = run_web
module = %(app)
home = %(base)/ers_portal_venv
pythonpath = %(base)
#socket file's location
socket = /home/metheuser/webapps/ers_portal/%n.sock
#permissions for the socket file
chmod-socket = 666
#uwsgi varible only, does not relate to your flask application
callable = app
#location of log files
logto = /home/metheuser/webapps/ers_portal/logs/%n.log
我的views.py
data_modification_time = None
data = None
def reload_data():
global data_modification_time, data, sites, column_names
filename = '/home/metheuser/webapps/ers_portal/app/static/' + ec.dd_filename
mtime = os.stat(filename).st_mtime
if data_modification_time != mtime:
data_modification_time = mtime
with open(filename) as f:
data = pickle.load(f)
return data
@a bunch of authentication stuff...
@app.route('/')
@app.route('/index')
def index():
return render_template("index.html",
title = 'Main',)
@app.route('/login', methods = ['GET', 'POST'])
def login():
login stuff...
@app.route('/my_table')
@login_required
def my_table():
print 'trying to access data table...'
data = reload_data()
return render_template("my_table.html",
title = "Rundata Viewer",
sts = sites,
cn = column_names,
data = data) # dictionary of data
我通过yum as described here安装了nginx(昨天) 我通过pip使用安装在我的venv中的uWSGI 我在CentOS 6上
我的uwsgi日志显示:
Wed Jun 11 17:20:01 2014 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 287] during GET /whm-server-status (127.0.0.1)
IOError: write error
[pid: 9586|app: 0|req: 135/135] 127.0.0.1 () {24 vars in 292 bytes} [Wed Jun 11 17:20:01 2014] GET /whm-server-status => generated 0 bytes in 3 msecs (HTTP/1.0 404) 2 headers in 0 bytes (0 switches on core 0)
当它工作时,views
“my_table
”路由中的print语句将打印到日志文件中。但不是一旦它停止工作。
有什么想法吗?