wsgi

Flask Apache on AWS EC2 - Read/Write Failing

空扰寡人 提交于 2019-12-13 08:12:15
问题 So I've been stumped by this problem for a day now. I'm relatively new to AWS EC2 so have been experimenting with Python Flask apps on it. I have an Ubuntu instance, and can get a flask app to run fine on it using Apache2 and WSGI. Only problem is whenever I put a line into my app that requests either a read or a write on the file system the server errors, but the error logs don't produce an error. Here's the function with some debug prints that errors the site: def cleanup_temps(): basePath

Configure WSGI with Django on OpenShift

会有一股神秘感。 提交于 2019-12-13 07:21:18
问题 I tried to configure WSGI with wsgi.py in my project folder import os import sys sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'])) os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings' virtenv = os.environ['OPENSHIFT_HOMEDIR'] + 'python/virtenv/' os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.7/site-packages') virtualenv = os.path.join(virtenv, 'bin/activate_this.py') try: execfile(virtualenv, dict(__file__=virtualenv)) except IOError: pass # # IMPORTANT

Error with WSGI when deploying Flask App to Azure

爷,独闯天下 提交于 2019-12-13 03:49:21
问题 I keep getting the following error when deploying an Azure Web using Flask: Unhandled exception in wfastcgi.py: Traceback (most recent call last): File "D:\home\python364x64\wfastcgi.py", line 791, in main env, handler = read_wsgi_handler(response.physical_path) File "D:\home\python364x64\wfastcgi.py", line 633, in read_wsgi_handler handler = get_wsgi_handler(os.getenv("WSGI_HANDLER")) File "D:\home\python364x64\wfastcgi.py", line 603, in get_wsgi_handler handler = getattr(handler, name)

Responding to client disconnects using bottle and gevent.wsgi?

岁酱吖の 提交于 2019-12-13 03:27:43
问题 I have a small asynchronous server implemented using bottle and gevent.wsgi. There is a routine used to implement long poll that looks pretty much like the "Event Callbacks" example in the bottle documentation: def worker(body): msg = msgbus.recv() body.put(msg) body.put(StopIteration) @route('/poll') def poll(): body = gevent.queue.Queue() worker = gevent.spawn(worker, body) return body Here, msgbus is a ZMQ sub socket. This all works fine, but if a client breaks the connection while worker

Writing doctests for pyramid web app which depend on settings in ini file

走远了吗. 提交于 2019-12-13 02:08:44
问题 I would like to write doctests for my pyramid web app, using the webtest module. I tried it like this: from my_webapp import main from webtest import TestApp app = TestApp(main({})) result = app.get('/') This raises a KeyError (because some.url is not known) when my code reaches this line: url = request.registry.settings['some.url'] The value of some.url is specified in the paster ini file of my application. Is there a simple way to use my development.ini when running my test code? I did not

Trying to start Chrome from WSGI/Python (admittedly quick-and-dirty) [Win. XP, x86, Python 2.7, Apache 2.2]

我只是一个虾纸丫 提交于 2019-12-13 01:18:19
问题 So typically I am too stubborn to use forum sites myself (call me proud), but this has been driving me absolutely mad. My goal is simply to start Chrome on a server machine, through that server's python WSGI script . I am aware of the bug that prevents Python from using Popen under WSGI, but I've figured out what seemed like a workable (albeit somewhat hack-y) solution: instead of calling Popen with the actual command, I created a .bat and called the bat through Popen with the shell argument

stumped by WSGI module import errors

谁说我不能喝 提交于 2019-12-12 18:08:22
问题 I'm writing a bare bones Python wsgi application and am getting stumped by module import errors. I have a .py file in the current directory which initially failed to import. By adding sys.path.insert(0, '/Users/guhar/Sites/acom') the import of the module worked. But I now try and import a module that I had installed via easy_install and it fails to import. I tried setting sys.path.insert(0, '/Library/Python/2.5/site-packages/') which contains the egg file, but to no avail. I would've thought

Why is `node.js` dying when called from inside python/uwsgi?

人盡茶涼 提交于 2019-12-12 17:13:58
问题 From the shell this python code which start and communicates with a node.js process works fine: > from subprocess import * > js = "(function(m) { console.log(m) })('hello world')" > (out,err) = Popen(["node"], stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=False).communicate(js) > out "hello world\n" But when I run the same code from within uwsgi I instead get this in err : 'FATAL ERROR: v8::Context::New() V8 is no longer usable\n' Any insights from either the wsgi community or the node.js

HTTPS to HTTP using CherryPy

…衆ロ難τιáo~ 提交于 2019-12-12 12:14:31
问题 Is it possible for CherryPy to redirect HTTP to HTTPS. Lets for example say the code below is http://example.com if someone visits via https://example.com I want them to be redirected to the plain HTTP URL (301 redirect maybe?) how do I accomplish this? #!/usr/bin/env python from pprint import pformat from cherrypy import wsgiserver def app(environ, start_response): status = '200 OK' response_headers = [('Content-type', 'text/plain')] start_response(status, response_headers) return [pformat

Fixing broken pipe error in uWSGI with Python

别说谁变了你拦得住时间么 提交于 2019-12-12 07:47:03
问题 While hitting a REST resource ( my_resource ) in Python, the uWSGI server is throwing the following error in its log: SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request my_resource (ip <my_ip>) !!! uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 164] IOError: write error It seems to be related to a timeout (the client disconnected before the request could finish processing). What sort of timeout is this and how can it be fixed? 回答1: it