problem about wsgi-Collection of common programming errors
Stefano
django apache nginx mod-wsgi wsgi
After a very standard and minor release, our Apache/Nginx/Django/wsgi setup ceased to function with the dreaded Premature end of script headers: django.wsgimessage in the log. There is no segfault anywhere and no other error message. There is no expat problem (checked with sample wsgi app with and without that module include). The server was working fine. The codebase was updated slightly and apache restarted when the horrors began. Here is my wsgi file:import sys import ossys.path.append(‘/hom
Teddy
php python session wsgi
I’ve got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user’s browser. I would prefer to avoid changing the behavior of the php app if at all possible.My questions:Is there anyway I can access the session variables from within python? Where should I start to look? Are there any obvious security/performance issues
Tshepang
python wsgi pyramid
INTROI’ve recently switched to Python, after about 10 years of PHP development and habits.Eg. in Symfony2, every request to server (Apache for instance) has to load eg. container class and instantiate it, to construct the “rest” of the objects.As far as I understand (I hope) Python’s WSGI env, an app is created once, and until that app closes, every request just calls methods/functions.This means that I can have eg. one instance of some class, that can be accessed every time, request is dispatch
coulix
django metaprogramming request wsgi
Using a decorator I was trying to add a method to WSGIRequest request, just like is_ajax(). Since I could not find a proper way I just updated request.META with the info needed.Should I look into adding method at runtime in Python ?
Mark
apache2 ubuntu-9.10 django wsgi
Ive got a Django web application setup with mod_wsgi and apache2 on ubuntu 9.10Im using the following code to o a user authentication via a HTTP post for another part of my site. All it required back is a HTTP 200.from django.contrib.auth import authenticate from django.http import HttpResponsedef post_authentication_api(request):if request.method == ‘POST’:print requestuser = authenticate(username=request.POST[‘user’], password=request.POST[‘pass’])if user is not None:if user.is_active:print “c
Blego
apache2 python wsgi mod-python
I have only seen some related questions to this with answers stating that there are version mix ups.Specs:Windows XP Apache HTTP server 2.2.22 Python 2.7.2 WSGI mod mod_wsgi-win32-ap22py27-3.3.soI have renamed the wsgi file to mod_wsgi.so and place it in my Apache modules folder.The only changes I have made to my Apache httpd.conf file is the following inserted line:LoadModule wsgi_module modules/mod_wsgi.so(I had inserted a wsgi script but commenting it out doesn’t make a difference.)My system
primroot
multithreading fork wsgi
I have a site which sometimes takes particularly long to process a request (and that’s not a defect). 99% of the time it’s pretty quick because it almost doesn’t do any processing.I want to show a message that says “Loading” when the site takes long to process the request. My site uses mod_wsgi and Apache. The way I see it, I would respond saying ‘Loading’ before completing the processing and do one of two things right before:-spawn a (daemon) thread to take care of the processing.-communicate t
gatoatigrado
flask wsgi
Does anyone know how to make a mod_wsgi automatically reload a Flask app when any of the modules changes? I’ve tried WSGIScriptReloading On, but no luck. The official documentation is kind of a bear … I guess I’ll give it a stab if no one knows. Thanks in advance!Also, if it could not permanently crash on syntax errors (like the the Flask reloader), that’d be awesome.
RadiantHex
python django apache mod-wsgi wsgi
I’m serving Django with mod_wsgi and Apache… unfortunately requests are returning 502 Bad Gateway error messages…Received a invalid responseHttpResponse(‘OK’) is affected by thisrender_to_response(‘…’) is not!any ideas?!?
yetty
python django apache response wsgi
I have a server with Apache and I would like to start website written in Django. I user mod_wsgi. Now I have it prepared. But the respond of a server is empty. And in error log, there is nothing. Do you know what is the reason why?If some file could help (*.wsgi, settings.py) I will append it.Prochazky.wsgiimport os import sys import siteos.environ[‘PYTHON_EGG_CACHE’] = ‘/home/prochazky/venv/.python-eggs’site.addsitedir(‘/home/prochazky/venv/lib/python2.6/site-packages’)os.environ[‘DJANGO_SETTIN
pyInTheSky
python wsgi cherrypy
I am new to cherrypy, and am moving code from pylons to cherrypy … I have a WSGIGateway object that i graft onto my cherrypy tree.cherrypy.tree.graft(mygatewayobj, ‘/foo/’)I also have a routes dispatcherdispatcher.connect(route = ‘/foo’, name =’foocontroller’, controller = mygatewayobj)Should I have both connections for the gateway, or is this redundancy a possible reason for my unexpected, error-message-less crashes? Also, if I do need to graft, should it be /foo/ or /foo?
Lafada
python tornado wsgi cherrypy
I’m coming from PHP/Apache world where running an application is super easy. Whenever PHP application crashes Apache process running that request will stop but server will be still ruining happily and respond to other clients. Is there a way to have Python application work in a smilar way. How would I setup wsgi server like Tornado or CherryPy so it will work similarly? also, how would I run several applications from one server with different domains?
Leopd
python opencv wsgi
I’ve got a django app that uses OpenCV for image processing and I’m running into problems deploying it in production. I can run the app just fine directly from python or using manage.py runserver. But when I try to run it inside apache / wsgi, as soon as it gets to the lineimport cvit blows up with[Thu Jan 27 01:13:16 2011] [notice] child pid 21348 exit signal Segmentation fault (11)I don’t know where to start debugging this. Maybe recompile opencv with some different flagss?FWIW, Python 2.6.
Nadia Alramli
python django fastcgi wsgi flup
I have a django app running on apache with fastcgi (uses Flup’s WSGIServer).This gets setup via dispatch.fcgi, concatenated below:#!/usr/bin/pythonimport sys, ossys.path.insert(0, os.path.realpath(‘/usr/local/django_src/django’))PROJECT_PATH=os.environ[‘PROJECT_PATH’]sys.path.insert(0, PROJECT_PATH)os.chdir(PROJECT_PATH)os.environ[‘DJANGO_SETTINGS_MODULE’] = “settings”from django.core.servers.fastcgi import runfastcgirunfastcgi(method=”threaded”,daemonize=’false’,)The runfastcgi is the one that
Baruch
python flask mod-wsgi wsgi werkzeug
I have a flask app which communicates with another web service. I have this error which only seems to occur when both applications are running on the same server, but I don’t know what the source is. The Flask application is hosted at /tools via a WSGIScriptAlias in Apache.[Thu May 23 13:11:44 2013] [error] [client 41.164.8.114] mod_wsgi (pid=25705): Exception occurred processing WSGI script ‘/opt/tools-frontend/wsgi.py’. [Thu May 23 13:11:44 2013] [error] [client 41.164.8.114] Traceback (most r
Graham Dumpleton
python django heroku wsgi gunicorn
I am getting the Application Error page when I try and see my page on heroku. This behaviour is completely independent of me pushing any new code. Every now and then the website will simply crash. It usually comes back with a few reloads.My procfile looks like this:web: python manage.py run_gunicorn -b 0.0.0.0:\$PORT -w 9 -k gevent –max-requests 250 –preload –settings=myblog.production_settingsand the output of heroku logs is:2013-08-27T21:58:35.847326+00:00 heroku[web.1]: Starting process wi
mlzboy
python crash wsgi restart
i have a wsgi server which use paste,for some unkonw reason,it will often crash,so i want to has a application or just some package can help me to slove this,when it crashed automaticly kill the process and restart it.Any advice is welcome.
Kristine T
python visual-studio-2010 apache lucene wsgi
I am deploying a django web project into a real server. The code contains Lucene search engine. The whole system run well in my own computer. However, when I put it on real server, whenever I want to do indexing or retrieving (the rest of system is running well if I don’t call indexing or retrieving), there is an error: Visual Studio Just-In-Time debugger “An unhandled win32 exception occurred in http.exe” or “An unhandled win32 exception occurred in python.exe”After this debug dialog appears, t
Jeremy
python unicode wsgi webob
I have a large web system written on top of WSGI that uses webob to access form data (no framework is involved). Randomly we’ll get unhandled exceptions of UnicodeDecodeError from browsers (or bots) sending in undecodable escape sequences in the query string or POST data. I’m looking for a good default behavior that doesn’t involve me getting an unhandled exception email.My first idea would be to write a site-wide middleware that accesses the params of a webob request object with an exception ha
mikez302
python fastcgi wsgi stderr
I am working on a website, hosted on DreamHost, using Python. For a while, I was using their default setup, which runs Python scripts using CGI. It worked fine, but I was worried that if I get a lot of traffic, it would run slow and use a lot of memory, so I switched it over to FastCGI using this module.Overall, it still works fine, but there is one major annoyance: I can’t seem to be able to see anything that gets written to the standard error stream. If anything goes wrong, my usual source of
Mack
python ajax cgi wsgi
Edited out silly mistakeI am using AJAX to access a python script, get some TEXT from the python script & display it on my webpage. My Problem: is that the response text is this “undefined” when it should be this “bbbb”I am confused as to where I am going wrong? Is it my python script is incorrect (not handling AJAX (?requests?) correctly), is it my javascript or is it my WSGI server I made?HTML & Javascript:<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3
Ross M Karchner
apache2 php wordpress wsgi
We use apache, mod_php, and mod_wsgi to serve a central wordpress site, with some paths instead powered by Django, so for example these pages might be powered by WordPress:oursite.com/ oursite.com/video/but these URL’s might be Django-powered:oursite.com/our-cool-django-app/ oursite.com/schedule/Right now, we use a long list of WSGIScriptAlias to map particular paths to Django. This annoying and labor intensive.So, is there a way that we can configure things such that:One or the other first atte
quodlibetor
apache2 wsgi
I’ve got this /etc/profile.d/myfile.sh:export MYVAR=myvalI also have a PassEnv MYVAR line in a <virtualhost> section of an apache conf dir.That lets me do things like:$ echo $MYVAR myval $ python >>> import os; os.getenv(‘MYVAR’) ‘myval’ $ sudo echo $MYVAR myval $ sudo -i root# echo $MYVAR myvalBut then, despite that being the case I get:root# /sbin/service httpd restart /sbin/service httpd restart Stopping httpd: [ OK ] Starting httpd:
agf
python mod-wsgi wsgi archlinux python-3.2
I actually had mod_wsgi working with python3.1, but after updating some software… it no longer works.I followed these instructions for python3.1 modified slightly for 3.2: https://wiki.archlinux.org/index.php/Mod_wsgiand while it seems to build/install ok, trying to start apache give me the error :Cannot load /etc/httpd/modules/mod_wsgi.so into server: /etc/httpd/modules/mod_wsgi.so: undefined symbol: PyCObject_FromVoidPtrjust as this guy got: Python 3.1.1 with –enable-shared : will not buil
Emil
python django wsgi psycopg2
environment: Ubuntu 10.04 LTS build Python 2.7.2 with ./configure –with-zlib –enable-unicode=ucs4 postgresql-9.0 wsgi Django 1.3 virtualenv apacheI am trying to build Ubuntu Django App Server. The installation completed with no error message. The exact installation method was successful with Ubuntu 11.04. However, when installation is completed on Ubuntu 10.04 and try to load psycopg2 from Django, I got the following error (I did not get this error on 11.04): File “/home/nreeves/venv/lib/pyth
JJC
python mysql google-app-engine wsgi google-cloud-sql
I have a Google App Engine app that uses a Google Cloud SQL instance for storing data. I need my instance to be able to serve hundreds of clients at a time, via restful calls, which each result in one or a handful of DB queries. I’ve wrapped the methods that need DB access and store the handle to the DB connection in os.environ. See this SO question/answer for basically how I’m doing it. However, as soon as a couple hundred clients connect to my app and trigger database calls, I start getting
Zero Piraeus
django nginx wsgi virtualenv pip
I’m having a small problem with my setup. I’m quite new to the Django world so bear with me. A friend who is familiar has set up a VPS (Ubuntu) for my project. I’m now on my own trying to add a new module (south) so I can use manage.py migrateWhen the virtualenv was deactivated I installed the module $ sudo pip -E /var/www/env/example.com install south $ touch /var/www/sites/example.com.wsgi $ source /var/www/env/example.com/bin/activateIt appeared to go fine $ yolk -lI see the south module.a
Haidro
python apache python-2.7 mod-wsgi wsgi
This one has no errorscursor.execute (“update `1` set `2`=’aaa’ where `1`=’5′”)This one has errors.cursor.execute (“update `1` set `2`=aaa where `1`=’5′”)The difference is, I am trying to pass the variable ‘aaa’ to it.Here is the error_log of apache[Tue May 14 21:20:24 2013] [error] [client 127.0.0.1]OperationalError: (1054, “Unknown column ‘aaa’ in ‘field list'”)In PHP I would simply type $aaa in the mysql query, so the assumption was in python I would simply type aaa.
JunYoung Gwak
django apache django-models mod-wsgi wsgi
I need some help with unresolvable Django errors.My website works very well when I “python manage.py runserver”, but when I try to deploy it using wsgi, it keeps making unknown errors. I tried my best to google these errors, but I can’t resolve it. Could anyone tell what my error is?Apache error log[error] /usr/local/lib/python2.6/dist-packages/django/middleware/csrf.py:262: DeprecationWarning: CsrfResponseMiddleware and CsrfMiddleware are deprecated; use CsrfViewMiddleware and the template tag
Graham Dumpleton
python apache mod-wsgi wsgi
I have working wsgi authentication on another server, however a second server is not accepting the same configuration and errors upon reload with the message:Syntax error on line 12 of /etc/apache2/sites-enabled/mydomain.com Unknown Authn provider: wsgi… failHere is the relevant portion of the config file (line 12 is WSGIAuthUserScript …)<Location /adirectory/>AuthType BasicAuthName “Answer me these questions two”AuthBasicProvider wsgiWSGIAuthUserScript /home/auser/domains/mydomain.com
Web site is in building