mod-wsgi

Django / Apache / mod_wsgi: No module named importlib

我们两清 提交于 2019-11-29 09:36:34
After working with django's dev server for the past two months, the time finally came to move to apache + mod_wsgi. The problem is when I go to my site (let's call it junux), to the URL mapped to the django app, things do not seem to work. When running the dev server on the server things work properly. The bottom-line of the error is given to me in the apache error_log: ImportError: Could not import settings 'junux_site.settings' (Is it on sys.path?): No module named importlib I'm aware this is similar to many other questions on the matter (there are so many that I won't even quote them here),

How can I activate a pyvenv vitrualenv from within python? (activate_this.py was removed?)

↘锁芯ラ 提交于 2019-11-29 09:13:19
I'm using Python 3.4, and having created a pyvenv, I'm looking to activate it from within a python process. With virtualenv, I used to use activate_this.py , but that appears to be gone in pyvenv. Is there now an easy way to effectively change the current interpreter to the virtualenv interpreter? I could probably mess around with the PATH (which is what activate_this.py did), but I'd like a simpler and stabler way. This is for use in a wsgi.py. pyvenv and the venv module don't support this out of the box. The third party virtualenv package does support this using activate_this.py , but that

static file with mod_wsgi in django

╄→尐↘猪︶ㄣ 提交于 2019-11-29 05:03:36
问题 I've searched a lot but I still have a problem with the static files (css, image,...) with my django website. I'm using mod_wsgi with apache on archlinux 64bits I've added it in my http.conf : LoadModule wsgi_module modules/mod_wsgi.so <VirtualHost *:80> WSGIDaemonProcess mart.localhost user=mart group=users processes=2 threads=25 WSGIProcessGroup mart.localhost LogLevel debug Alias /media /home/mart/programmation/python/django/martfiles/media/ <Directory /home/mart/programmation/python

Apache Django Mod_Wsgi - auto reload

倖福魔咒の 提交于 2019-11-29 04:06:09
问题 I am trying to auto reload my django app which uses apache + mod_wsgi on my local windows machine. I'd like to know where do I add this code that's referenced in the following article: http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode def _restart(path): _queue.put(True) prefix = 'monitor (pid=%d):' % os.getpid() print >> sys.stderr, '%s Change detected to \'%s\'.' % (prefix, path) print >> sys.stderr, '%s Triggering Apache restart.' % prefix import ctypes ctypes.windll.libhttpd.ap

mod_wsgi working directory and user

爷,独闯天下 提交于 2019-11-29 03:58:38
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: <VirtualHost *:80> ServerName mysite.com ServerAlias site.com ServerAdmin admin@localhost

Where do I put “WSGIPassAuthorization On”?

岁酱吖の 提交于 2019-11-29 03:41:55
I'm trying to see the Authorization header in Django, using mod_wsgi. I read that Apache holds back the Authorization header by default, I've put << WSGIPassAuthorization On >> in my Apache VirtualHost block and . . . nada. How do I figure out where to put this? Put it at same place as WSGIScriptAlias and it should work fine. Connect to your EC2, go to etc/httpd/conf.d folder and open wsgi.conf file. Insert the code within VirtualHost DOM: WSGIPassAuthorization On RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] 来源: https://stackoverflow.com

Hello World in mod_wsgi

风流意气都作罢 提交于 2019-11-29 03:23:10
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', str(len(output)))] start_response(status, response_headers) return [output] VirtualHost Configuration

Python - why can I import modules without __init__.py at all?

限于喜欢 提交于 2019-11-29 02:39:24
问题 I'm new to Python and I still can't get my head around why we need a __init__.py file to import modules. I have gone through other questions and answers, such as this. What confuses me is that I can import my modules without __init__py , so why do I need it at all ? My example, index.py modules/ hello/ hello.py HelloWorld.py index.py, import os import sys root = os.path.dirname(__file__) sys.path.append(root + "/modules/hello") # IMPORTS MODULES from hello import hello from HelloWorld import

running Apache + Bottle + Python

痞子三分冷 提交于 2019-11-29 02:03:14
I'm trying to run Bottle.py with Apache and mod_wsgi. I'm running it on windows, using a xampp. python v2.7 My Apache config in httpd: <VirtualHost *> ServerName example.com WSGIScriptAlias / C:\xampp\htdocs\GetXPathsProject\app.wsgi <Directory C:\xampp\htdocs\GetXPathsProject> Order deny,allow Allow from all </Directory> </VirtualHost> My app.wsgi code: import os os.chdir(os.path.dirname(__file__)) import bottle application = bottle.default_app() My hello.py: from bottle import route @route('/hello') def hello(): return "Hello World!" When I go to localhost/hello I get a 404 error. I don't

Apache SetEnv not working as expected with mod_wsgi

谁都会走 提交于 2019-11-29 01:50:35
问题 In a flask application I wrote, I make use of an external library which can be configured using environment variables. Note: I wrote this external library myself. So I could make changes if necessary. When running from the command line an running the flask server with: # env = python virtual environment ENV_VAR=foo ./env/bin/python myapp/webui.py it all woks as expected. But after deploying it to apache, and using SetEnv it does not work anymore. In fact, printing out os.environ to stderr (so