WebFaction
Community site: login faq

I'm having an issue deploying my Flask app with Apache (mod_wsgi) and gevent on a shared hosting (Webfaction).

The application works fine in the development server provided by Flask, but when I try to deploy it I get the following error in log file:

[Tue Mar 13 15:48:24 2012] [error] Traceback (most recent call last):
[Tue Mar 13 15:48:24 2012] [error]   File "evdns.pxi", line 78, in gevent.core.__evdns_callback (gevent/core.c:6300)
[Tue Mar 13 15:48:24 2012] [error]   File "/home/username/.virtualenvs/staging/lib/python2.7/site-packages/gevent/hub.py", line 297, in switch_args
[Tue Mar 13 15:48:24 2012] [error]   File "/home/username/.virtualenvs/staging/lib/python2.7/site-packages/gevent/hub.py", line 290, in switch
[Tue Mar 13 15:48:24 2012] [error]   File "/home/username/.virtualenvs/staging/lib/python2.7/site-packages/gevent/hub.py", line 135, in get_hub
[Tue Mar 13 15:48:24 2012] [error] NotImplementedError: gevent is only usable from a single thread

I need gevent because I'm using the python-requests' async module to make concurrent HTTP requests. I tried to Google around but the only advice I found is to to call

from gevent import monkey
monkey.patch_all()

something that I already do in my code.

The value of WSGIDaemonProcess is:

WSGIDaemonProcess myapp processes=5 python-path=/home/myusername/webapps/myapp/lib/python2.7 threads=1

Here is my httpd.conf: http://pastebin.com/eWygicJH

Anybody has any advice to solve this issue?

asked 14 Mar '12, 14:32

raben
122
accept rate: 0%


The official flask docs describe serving over gevent here.

Have you tried using a wsgi file as outlined there?

permanent link

answered 14 Mar '12, 22:03

johns ♦♦
5.3k212
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×224
×55
×44
×4

question asked: 14 Mar '12, 14:32

question was seen: 5,269 times

last updated: 14 Mar '12, 22:03

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM