wsgi

Websockets. FastCGI or WSGI. SSL. Same domain. How?

不打扰是莪最后的温柔 提交于 2020-01-02 15:12:06
问题 Question I've built an app in two parts: a low-overhead server which listens for long-polling and websocket connections using Socket.IO and a regular WSGI-compatible Python webapp. The former would be bound to the path /socket.io/ and the latter to every other path. Additionally, files in /static/ can be served directly from the filesystem and with far-future expiration headers. I figured it would easy to put a proxy in front of the two services which would serve the whole site via SSL, but I

Unterstanding eventlet.wsgi.server

送分小仙女□ 提交于 2020-01-02 09:56:51
问题 I have this simple Python programm: from eventlet import wsgi import eventlet from eventlet.green import time def hello_world(env, start_response): print "got request" time.sleep(10) start_response('200 OK', [('Content-Type', 'text/plain')]) return ['Hello, World!\n'] wsgi.server(eventlet.listen(('', 8090)), hello_world) So when i run it, and open http://localhost:8090/ on my browser multiple times, got request is only printed after the first request was already processed (after 10 seconds).

How can I tell Phusion Passenger which python to use?

帅比萌擦擦* 提交于 2020-01-02 05:15:14
问题 I'm using Phusion Passenger with a ruby app and I'd also like to set it up to work with an django appengine app I'm working on. Googling for "passenger_wsgi.py" I was able to get the following very simple non-django app working on passenger: passenger_wsgi.py: def application(environ, start_response): response_headers = [('Content-type','text/plain')] start_response('200 OK', response_headers) return ['Hello World!\n'] However, if I add the line import django.core.handlers.wsgi into the mix,

Apache WSGI permission error using django logging on production server

不打扰是莪最后的温柔 提交于 2020-01-01 18:19:32
问题 Here is some software information Django 1.8.1 Apache2 Fedora 21 error_log output mod_wsgi (pid=8272): Target WSGI script '/var/www/anime/anime/wsgi.py' cannot be loaded as Python module. mod_wsgi (pid=8272): Exception occurred processing WSGI script '/var/www/anime/anime/wsgi.py'. Traceback (most recent call last): File "/usr/lib64/python3.4/logging/config.py", line 557, in configure handler = self.configure_handler(handlers[name]) File "/usr/lib64/python3.4/logging/config.py", line 725, in

FastCGI WSGI library in Python 3?

好久不见. 提交于 2020-01-01 07:50:27
问题 Does there exist any library that can serve a WSGI application as a FastCGI server, for Python 3? (So that nginx could then proxy requests to it?) The Python 3 docs mention flup, but flup doesn't even install in Python 3: % env3/bin/pip install flup Downloading/unpacking flup Downloading flup-1.0.2.tar.gz (49kB): 49kB downloaded Running setup.py (path:/Users/me/tmp/env3/build/flup/setup.py) egg_info for package flup Traceback (most recent call last): File "", line 17, in File "/Users/me/tmp

How to return an apache error page from a wsgi app?

删除回忆录丶 提交于 2020-01-01 06:36:26
问题 I have a simple working wsgi app. I can successfully return whatever HTTP status code, headers, and HTML I want. What I would like to do, is that when I'm returning a status code other than '200 OK', for WSGI to let apache fall back to its error handling and display whatever page apache is configured to display according to its 'ErrorDocument' setting. For example, this works fine when my WSGI app crashes unintentionally, then I see the default 'internal server error' page from apache. My

How to return an apache error page from a wsgi app?

拈花ヽ惹草 提交于 2020-01-01 06:35:51
问题 I have a simple working wsgi app. I can successfully return whatever HTTP status code, headers, and HTML I want. What I would like to do, is that when I'm returning a status code other than '200 OK', for WSGI to let apache fall back to its error handling and display whatever page apache is configured to display according to its 'ErrorDocument' setting. For example, this works fine when my WSGI app crashes unintentionally, then I see the default 'internal server error' page from apache. My

Django File Upload

旧街凉风 提交于 2020-01-01 05:19:22
问题 Here is the code in views: def index(request): if request.method == 'POST': a=request.POST # logging.debug(a["title"]) # logging.debug(a["file"]) #form = UploadFileForm() form = UploadFileForm(request.POST, request.FILES) #handle_uploaded_file(request.FILES['file']) if form.is_valid(): handle_uploaded_file(request.FILES['file']) return HttpResponseRedirect('/') else: form = UploadFileForm() return render('upload.html', {'form': form}) def handle_uploaded_file(file): # logging.debug("upload

(13)Permission denied: mod_wsgi Unable to connect to WSGI

心不动则不痛 提交于 2020-01-01 04:27:09
问题 I'm trying to run django 1.3.1 on new vps server (CentOS 6). Right now I'm getting this error: (13)Permission denied: mod_wsgi (pid=7159): Unable to connect to WSGI daemon process 'somodinteriors:80' on '/etc/httpd/logs/wsgi.7152.0.1.sock' after multiple attempts. I read how to fix it by adding WSGISocketPrefix (you can reed about it here) This is my config file: #Alias /robots.txt /var/www/vhosts/domain.co.uk/httpdocs/robots.txt #Alias /favicon.ico /var/www/vhosts/domain.co.uk/httpdocs

Pros and Cons of different approaches to web programming in Python

痞子三分冷 提交于 2019-12-31 09:15:14
问题 I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that. It starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the job themselves. And a huge lot of stuff in between, like web.py, Pyroxide and Django. What are the pros and cons of the frameworks or approaches that you've worked on ? What trade-offs are there? For what kind of projects they do well and for what