mod-wsgi

Django: Setup an efficient logging system for a website in production

风流意气都作罢 提交于 2019-12-24 02:34:07
问题 Alright so the development phase is over and now my website is live in prod. However, I have not set up the logging. My website is located in /var/www/html dir. Ideally I would like to have Django logging in /var/log/django but that would require permissions. Is it standard practice to keep Django logs in /var/log/? What type of permissions I need for the logs to store in /var/log. I just want logs for last 2 days and today, rest can automatically be removed if I can. Setup: RHEL7, Apache2.4,

mod_wsgi: import python modules with the same name

瘦欲@ 提交于 2019-12-24 01:25:54
问题 This is a follow-up question to import python modules with the same name, but as the two are somewhat unrelated, it's probably better to ask a new question: I have several python projects and they all have a conf package: /some_folder/project_1/ conf/ __init__.py some_source_file.py /another_folder/project_2/ conf/ __init__.py another_source_file.py For each project, I have created a .pth file in the site-packages folder with this contents: .../site-packages/project_1.pth: import sys; sys

Import conflict when running flask app with apache mod_wsgi on windows

╄→гoц情女王★ 提交于 2019-12-23 22:25:20
问题 I am permit you to ask you about a problem that I have with hosting flask application with your portage of mod_wsgi on windows I have two flask application and only one can be alive a the same times due to conflict in import ie : If a request application 1 I have a response Then if I request application 2 I have internal server error with error in log ... Then if I restart apache and I request application 2 I have a response but if I request application 1 I have the same internal server error

Tool to upgrade current python installation

删除回忆录丶 提交于 2019-12-23 21:35:29
问题 I have Python 2.7 installed with ampps. I tried to modify python.conf to make it point to another installation of Python 3.3 but it leads to errors in Apache start up. LoadModule wsgi_module modules/mod_wsgi.so WSGIPythonPath "C:/Python33/Lib;C:/Python33/Lib/site-packages;C:/Python33/DLLs" WSGIPythonHome "C:/Python33" It generates the following error: [Fri Aug 15 01:48:38.114336 2014] [mpm_winnt:notice] [pid 6084:tid 412] AH00418: Parent: Created child process 5592 File "C:/Python33\lib\site

How to make Bottle print stacktrace when running through apache modwsgi?

风格不统一 提交于 2019-12-23 21:04:08
问题 When running Bottle as a standalone server it's very easy to do: from bottle import run, Bottle run(app=app, host=config.get('bottle_host', 'localhost'), port=config.get('bottle_port', '8080'), debug=config.get('debug', True), server=config.get('server_middleware', 'tornado')) The problem is that with wsgi I have to do this: app = Bottle() And Bottle constructor doesn't have any debug parameter. So what can I do to get the stacktrace? 回答1: import bottle bottle.debug(True) If you look at the

Target WSGI script '/var/www/backend/backend/wsgi.py' cannot be loaded as Python module

烈酒焚心 提交于 2019-12-23 17:27:52
问题 I'm deploying a Django web app on ubuntu server. Configuration are set. But, somehow, it show an 500 Internal Server Error. I checked the apache error log and found the following error entry : [Tue Mar 26 08:50:56.540300 2019] [wsgi:error] [pid 18832] [remote 27.61.32.236:42365] mod_wsgi (pid=18832): Target WSGI script '/var/www/backend/backend/wsgi.py' cannot be loaded as Python module. [Tue Mar 26 08:50:56.540376 2019] [wsgi:error] [pid 18832] [remote 27.61.32.236:42365] mod_wsgi (pid=18832

Why isn't Flask giving me an interactive debugger?

笑着哭i 提交于 2019-12-23 13:53:52
问题 Here's a simple Flask app with a syntax error (it should be sys.version , not sys.version() from flask import Flask, url_for, request, render_template import sys app = Flask(__name__) app.config.from_object(__name__) @app.route('/') def index(): version = sys.version() return "This is the index page. Python version info: {}".format(version) if __name__ == '__main__': app.run(debug=True) When I run it locally and try to access http://localhost:5000, I get the nice Werkzeug debugger: but when I

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5

╄→гoц情女王★ 提交于 2019-12-23 09:26:24
问题 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 537: ordinal not in range(128), referer: ... I always get this error when I try to output my whole website with characters "č". I am using mako templating. What to do? 回答1: The error occurs because somewhere code coerces your unicode template string into a python 2 str ; you need to encode the rendered template into an UTF-8 bytestring yourself: if isinstance(rendered, unicode): rendered = rendered.encode('UTF-8') # rendered

Python Flask mod-wsgi Custom Headers not in Request

孤街浪徒 提交于 2019-12-23 09:06:16
问题 I've a simple Python Flask application, which is being served by Apache via mod_wsgi. The part of my application which works perfectly on my localhost, but does not work through mod_wsgi is the accessing of custom request headers. When I request a certain web page, I pass it a header called auth_user . On my localhost, I am able to access this header as: request.headers["auth_user"] , which works great. However when served through Apache and mod_wsgi, this custom header does not exist!

apache2 mod_wsgi crashes when importing pyodbc

五迷三道 提交于 2019-12-23 04:01:46
问题 Operating system - Ubuntu Server 14.04 on Azure VM Tried with different versions of python (3.4.3, 3.6.0), apache and mod_wsgi. Installed MS Native ODBC driver using instructions from here https://gist.github.com/joecampo/6f777a659b8132b9d6fe1c3589df394c , while pyodbc was installed using pip. To debug the wsgi_module I have set up the django application to run in embedded mode and: gdb /usr/local/apache2/bin/httpd run -X When I access any function which imports pyodbc, the wsgi fails with