mod-wsgi

How to launch a pdftk subprocess while in wsgi?

限于喜欢 提交于 2019-12-01 15:03:57
问题 I need to launch a pdftk process while serving a web request in Django, and wait for it to finish. My current pdftk code looks like this: proc = subprocess.Popen(["/usr/bin/pdftk", "/tmp/infile1.pdf", "/tmp/infile2.pdf", "cat", "output", "/tmp/outfile.pdf"]) proc.communicate() This works fine, as long as I'm executing under the dev server (running as user www-data ). But as soon as I switch to mod_wsgi, changing nothing else, the code hangs at proc.communicate() , and "outfile.pdf" is left as

django UnreadablePostError: request data read error

杀马特。学长 韩版系。学妹 提交于 2019-12-01 13:51:51
问题 I'm working on django project and I got this error email. Stack trace File "/usr/local/lib/python2.7/dist-packages/Django-1.4.3-py2.7.egg/django/core/handlers/wsgi.py", line 180, in _get_post self._load_post_and_files() File "/usr/local/lib/python2.7/dist-packages/Django-1.4.3-py2.7.egg/django/http/__init__.py", line 379, in _load_post_and_files self._post, self._files = QueryDict(self.body, encoding=self._encoding), MultiValueDict() File "/usr/local/lib/python2.7/dist-packages/Django-1.4.3

Anaconda + Apache + mod_wsgi + Ubuntu

若如初见. 提交于 2019-12-01 12:58:23
I'm running a server with Ubuntu and Apache. Now I'm trying to get Anaconda working with mod_wsgi but just can't get it to work. First off. It is working if I use mod_wsgi-express. By following the instruction at https://anaconda.org/pypi/mod_wsgi in section Installing into Python I can get it working by first setting PYTHONHOME=/opt/anaconda and then /opt/anaconda3/bin/mod_wsgi-express start-server . I want to use Apache so I load the mod_wsgi module from anaconda into apache. And then I have a VirtualHost looking like this: WSGIPythonHome /opt/anaconda3 WSGIPythonPath /opt/anaconda3/lib

Preserving state in mod_wsgi Flask application

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 12:50:09
问题 I have a Flask application running under mod_wsgi that makes a connection to a database. There are multiple processes running this application (only one thread per process) and one database connection for each of these processes. Currently I have something like this: myapp_wsgi.py import myapp app = myapp.setup() def application(environ, start_response): return app(environ, start_response) myapp.py from flask import Flask app = Flask(__name__) db = None def setup(): global db db = get_db() #

Can't load mod_wsgi compiled for Python 3

邮差的信 提交于 2019-12-01 11:50:41
I'm on CentOS and trying to configure Apache to use mod_wsgi compiled against Anaconda Python 3.5. Compiling mod_wsgi seems to go OK: sudo yum install httpd-devel sudo ./configure --with-python=/opt/anaconda/anaconda3/bin/python sudo make ls -l /etc/httpd/modules/mod_wsgi.so -rwxr-xr-x. 1 root root 702205 Mar 2 23:12 /etc/httpd/modules/mod_wsgi.so But when I start the web server it can't seem to find its libraries: sudo service httpd start Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/wsgi.conf: Cannot load /etc/httpd

Can I deploy both python 2 and 3 django app with apache using mod_wsgi?

前提是你 提交于 2019-12-01 11:11:34
I am running on ubuntu 14.04. And I am wondering can I deploy my django apps coded with python 2 and 3 together with apache and mod_wsgi? and how? No you cannot. The mod_wsgi module for Apache is compiled for one Python version only. You cannot load more than one instance of mod_wsgi into Apache at the same time. What you may be better off doing is using mod_wsgi-express, which allows running of Apache with mod_wsgi in a more easy way where mod_wsgi is a part of your Python installation or virtual environment. You could then have any front end web server proxy to different mod_wsgi-express

Django application not visible

杀马特。学长 韩版系。学妹 提交于 2019-12-01 10:45:41
I am trying to deploy a Django application for the first time using mod_wsgi with Apache on a Ubuntu 12.04 VM. I have been following several tutorials, especially Ayman Farhat blog , this excellent YouTube video and of course the official Django Documentation This follows an earlier question I posted here wondering why my Django survey did not simply work when I uploaded it to the /var/www/ (blush!) I have since been looking into mod_wsgi as per the answers. I'm not sure what stage I am missing. The project is able to start on the server via python manage.py runserver with no errors. I have

apache2, mod_wsgi, python web app (bottle framework)

徘徊边缘 提交于 2019-12-01 10:38:09
问题 Note: I guess the bottle framework is not relevant here . Wsgi is. I've managed to configure my apache to work with wsgi and one-file web application based on python bottle framework. Below files are what I've got right now - apache uses virtualenv and runs a single wsgi/py file containing everything. virtual host: <VirtualHost *:80> ServerName bottle-test WSGIDaemonProcess bottle-test user=www-data group=www-data processes=1 threads=5 WSGIScriptAlias / /home/tducin/Development/Python/bottle

Django AND .htaccess rewrites/redirects, is this possible?

假装没事ソ 提交于 2019-12-01 09:16:20
Is it possible to have Apache htaccess rewrites take effect before it hits django? I want to be able to specify RewriteRules in an htaccess file that take precedence over django, and if nothing matches then it gets dispatched to mod_wsgi/django. We're using apache2 with mod_wsgi and the apache vhost looks like this: <VirtualHost *:80> DocumentRoot /usr/local/www/site/static Alias /css/ /usr/local/www/site/static/css/ Alias /js/ /usr/local/www/site/static/js/ Alias /img/ /usr/local/www/site/static/img/ Alias /flash/ /usr/local/www/site/static/flash/ <Directory /usr/local/www/site/static>

Django application not visible

♀尐吖头ヾ 提交于 2019-12-01 08:28:49
问题 I am trying to deploy a Django application for the first time using mod_wsgi with Apache on a Ubuntu 12.04 VM. I have been following several tutorials, especially Ayman Farhat blog, this excellent YouTube video and of course the official Django Documentation This follows an earlier question I posted here wondering why my Django survey did not simply work when I uploaded it to the /var/www/ (blush!) I have since been looking into mod_wsgi as per the answers. I'm not sure what stage I am