mod-wsgi

mod_wsgi working directory and user

 ̄綄美尐妖づ 提交于 2019-11-27 18:03:17
问题 I'm running flask on mod_wsgi. my flask app, which is on /var/www/app receives some file from user and saves it to /var/www/app/tmp directory. However even after all chmod and chown(thought it was a permission problem), I was unable to reach that tmp directory. After some debugging I found out that the current working directory of the flask app is / . I can change working directory by os.chdir('/var/www/') , but I'd like to avoid that for security concerns. here is my apache configuration:

Deploying multiple django apps on Apache with mod_wsgi

懵懂的女人 提交于 2019-11-27 17:53:25
I want to deploy two different django apps in the same host: The first will correspond to the url /site1 and the second to the url /site2. Here's my configuration: LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /site1 /var/www/py/site1/site1/wsgi.py WSGIScriptAlias /site2 /var/www/py/site2/site2/wsgi.py WSGIPythonPath /var/www/py/site1:/var/www/py/site2 <Directory "/var/www/py/site1/site1"> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> <Directory "/var/www/py/site2/site2"> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> Also here's the

Hello World in mod_wsgi

拥有回忆 提交于 2019-11-27 17:33:40
问题 After failing repeatedly in my quest to get my flask application to run on Apache using mod_wsgi I decided to try running the hello world example. Here is what I have - Directory Structure (I changed the apache default /var/www to ~/public_html ) - public_html - wsgi-scripts - test_wsgi.wsgi - test_wsgi - test_wsgi.wsgi test_wsgi.wsgi file def application(environ, start_response): status = '200 OK' output = 'Hello World!' response_headers = [('Content-type', 'text/plain'), ('Content-Length',

Run Django with URL prefix (“subdirectory”) - App works, but URLs broken?

痞子三分冷 提交于 2019-11-27 16:23:01
问题 Below are the relevant configuration files, also at http://dpaste.com/97213/ . The apache config is currently working, because accessing 'example.com/' shows me the index.html file I have placed at the document root. I'd like to serve Django/apps at the prefix '/d', so 'example.com/d/' would load the default app, 'example.com/d/app3' would load another, as configured in urls.py. Serving Django, I'm using the suggested mod_wsgi, on Linux. Currently, I can access the Ticket app at 'example.com

Python POST data using mod_wsgi

限于喜欢 提交于 2019-11-27 14:44:52
问题 This must be a very simple question, but I don't seem to be able to figure out. I'm using apache + mod_wsgi to host my python application, and I'd like to get the post content submitted in one of the forms -however, neither the environment values, nor sys.stdin contains any of this data. Mind giving me a quick hand? Edit: Tried already: environ["CONTENT_TYPE"] = 'application/x-www-form-urlencoded' (no data) environ["wsgi.input"] seems a plausible way, however, both environ["wsgi.input"].read(

Django (wsgi) and Wordpress coexisting in Apache virtualhost

最后都变了- 提交于 2019-11-27 13:50:10
I have a Django project that I need mounted at two different subdirectories of my url, and I need Wordpress running at /. So: *.example.com - WordPress *.example.com/studio - django *.example.com/accounts - django Here's the httpd.conf that I have so far: <VirtualHost *:80> ServerName wildcard.localhost ServerAlias *.localhost AddType application/x-httpd-php .php DocumentRoot /var/empty Alias /site_media/ /home/zach/projects/python/myproject/static/ Alias /media/ /home/zach/projects/python/myproject/env/lib/python2.6/site-packages/django/contrib/admin/media/ Alias / /home/zach/projects/python

Install mod_wsgi on Ubuntu with Python 3.6, Apache 2.4, and Django 1.11

邮差的信 提交于 2019-11-27 12:12:11
问题 How do I get mod_wsgi for Apache2 that was compiled for Python 3.6.1? (or any future Python version) I am using a Python 3.6.1 virtual environment with Django 1.11 and Everything is working according to the Apache error log except that mod_wsgi for Apache 2.4 was compiled for Python/3.5.1+ and is using Python/3.5.2 so my Python 3.6.1 code is failing because I'm using new features not available in 3.5.2 All of the other configurations and installs involved in setting my system up seem to be

Apache not serving django admin static files

时间秒杀一切 提交于 2019-11-27 11:19:16
Let me thanks you guys at the Stack Overflow community for helping me with various Django and Apache (with mod_wsgi) errors. I've asked about 5 related questions so far and now I'm getting closer and closer to getting my content out on a production site! So I know there are many similar questions about this and I have read a bunch of questions about serving static media files on Django . I read about STATIC_URL , STATIC_ROOT , the (soon to be obsolete) ADMIN_MEDIA_PREFIX , and setting a Alias /media/ ... in the Apache configuration. I tried to test out each solution one by one, but I couldn't

Unable log in to the django admin page with a valid username and password

让人想犯罪 __ 提交于 2019-11-27 10:28:01
问题 I can’t log in to the django admin page. When I enter a valid username and password, it just brings up the login page again, with no error messages This question is in the django FAQ, but I've gone over the answers there and still can't get past the initial login screen. I'm using django 1.4 on ubuntu 12.04 with apache2 and modwsgi. I've confirmed that I'm registering the admin in the admin.py file, made sure to syncdb after adding INSTALLED_APPS . When I enter the wrong password I DO get an

error: can't start new thread

ⅰ亾dé卋堺 提交于 2019-11-27 08:18:44
I have a site that runs with follow configuration: Django + mod-wsgi + apache In one of user's request, I send another HTTP request to another service, and solve this by httplib library of python. But sometimes this service don't get answer too long, and timeout for httplib doesn't work. So I creating thread, in this thread I send request to service, and join it after 20 sec (20 sec - is a timeout of request). This is how it works: class HttpGetTimeOut(threading.Thread): def __init__(self,**kwargs): self.config = kwargs self.resp_data = None self.exception = None super(HttpGetTimeOut,self)._