python 2.6.4 doesn't support mod_python? - python

am looking for a way to run django by just using my xampp, and i bumped into this tutorial online
http://jyotirmaya.blogspot.com/2008/11/xampp-python-django.html
according to the author, mod_python 3.3.1 is not supported by python 2.6, but the blog post was created more then a year ago i think. is this thing still true until now? or its ok if I will use 2.6 and combine it with mod python 3.3.1 ?

mod_python must be compiled against the specific version of Python that the handler will be run in. At the time there was probably no Windows installer for mod_python built against 2.6.4, hence the hysteria.
In all fairness, you should probably be using mod_wsgi to run Django apps instead.

Related

Set python version in heroku review apps

The review apps are running on the latest python version 3.9.4 and that seems to break the installation of pandas. I'm currently using review apps to review PRs. I have set the runtime to use python version 3.8.6 but that only works for the app in production. Is there any way to set the python version for review apps?
Seems setting a python runtime fixes it(make sure to update the branch before trying to check unlike me).

Python3 Django project use the Python2 library

I have a project with Python 3.5.4, but I want to use a Python library called pyghmi, but the library only supports the Python 2.x.
How can I solve this issue?
The project was updated for python3 and is tested with python 3.5, though I will confess the vast majority of users are using python 2.7 at the moment. The building of rpms, however, has not yet been tested for python3 (so far system python of centos 6 and centos7 has been the rpm environment).
I would be interested to know the issue you are hitting.

Web page building with python 3.3?

I am going through a tutorial on building a website with django. It suggests using mod_python but I have heard to stay away from that and use wsgi instead. Problem is I am running python 3.3 (and apache 2.4.2 for that matter, everything seems to be compatible with apache 2.2). Is there any way to get all of this working on 3.3? Or is my best bet to go back to python 2.7? Thanks.
Edit: I am on Windows, so that seems to be another roadblock.
You could use nginx + uwsgi to depoly your django site instead of Apache+mod_wsgi. Here's a tutorial.
As many tutorials is about how to configure the environment in Unix-like environment, you could use cgywin to simulate a Unix-like environment on Windows.
The version of Python you use is not much critical when you develop a site using Django except that you have to use some libraries that don't support Python-3.x.
It will be hard, between python2 and python3 there is a lot of incompatibility, and somehow the developers of the most python frameworks somehow won't understand, why they should port their software to the newer version of the language.
The simplest way if you use python 2.
The best way were to start an independent, python 3 fork of your most loved python framework.
EDIT: newer django supports python3, thus it should work.

Apache mod_wsgi 32-bit/64-bit Python compatibility

I use Zend Studio / Zend Server for developing my PHP-based web sites, but now I'm taking a course in Python, and I want to learn Django.
I have a Windows 7 AMD-64 machine, and am using 64-bit Python 2.6 (version 2.6 is required by the course), and that part works fine.
My problem is trying to add mod_wsgi to my Zend Server's 32-bit Apache installation. I've downloaded several versions of mod_wsgi 32-bit Windows binaries for Python 2.6, and copied them to C:Program Files (x86)\Zend\Apache2\modules directory, edited httpd.conf and added:
LoadModule wsgi_module modules/mod_wsgi.so
restarted Apached2.2-Zend, and then tested if mod_wsgi was loaded at the command prompt with:
httpd -t -M
However, mod_wsgi does not show up on the list of loaded modules.
I finally figured this might not be working because I cannot mix-and-match 64-bit Python 2.6 with 32-bit ZendServer Apache2.2.
So here's the meat of my question:
Can I install a 64-bit version of Apache 2.2 and run that at the same time as ZendServer Apache2.2 (but configure the 64-bit version so it doesn't listen on the same ports as my ZendSever Apache2.2) so all my local PHP virtual hosts still work? Maybe I would have better luck getting mod_wsgi to load with this Apache?
Or, would it be better to install a 32-bit version of Python (probably a higher version like Python 2.8, since I only need Python 2.6 for my coursework, and I am trying to get Django working just for my own web site development)? Would that allow my ZendServer Apache2.2 to load mod_wsgi? Also, how does Apache figure out which installation of Python it should be using if I have both on my Windows 7 machine?
Can I install a 64-bit version of Apache 2.2 and run that at the same time as ZendServer Apache2.2 (but configure the 64-bit version so it doesn't listen on the same ports as my ZendSever Apache2.2)
Yes, you can.
You've already thought about the hardest problem: that it can't listen on the same ports.
A related problem is that some people's networks don't allow them to make outgoing connections to, say, port 8080; if you want to deal with that, you'll need to set up your ZendServer to act as a forward proxy for the other server. But that's really about it.
The only other problem is that you need to make sure your two copies of Apache don't try to share the same config files, etc. (and you may not want both of them on your PATH, either).
Or, would it be better to install a 32-bit version of Python (probably a higher version like Python 2.8
There is no 2.8, and never will be. The last 2.x version is 2.7 (although it continues to get bug fixes, and is up to 2.7.5). If you want something higher, you have to go to 3.x. If everything you need runs on 3.3 (and Django 1.5+ does), and you're willing to learn the small changes, you should consider this. But if you want to stick with what you already know, get 2.7.5.
Would that allow my ZendServer Apache2.2 to load mod_wsgi?
Well, not if you're using a mod_wsgi for Python 2.6 and install a Python 2.7 or 3.3… or using a mod_wsgi for native Python and install a Cygwin Python… etc. But I suspect you already know that (given "I've downloaded several versions of mod_wsgi 32-bit Windows binaries for Python 2.6").
Other than that, yes. As long as everything is built and configured right, it will work. (I have no idea what particular packages you downloaded and installed, so I can't promise whether they will work, of course.)
Also, how does Apache figure out which installation of Python it should be using if I have both on my Windows 7 machine?
This is configurable. I believe the default is to use either whatever it finds first on your PATH, or whatever shows up as the "default python 2.x" in your registry settings, as used by the Python command-line launcher described in PEP 397. (And of course if that Python is not the one it was built against, it will fail to start up.)

Apache looks for Python 2.6 instead of 2.7

My OS already has Python 2.6.6 and I've installed Python 2.7.3 as an alternative. (Python's working fine). I've installed mod_python also, but when I try to execute a Python file on an Apache server, it shows me a list of errors where I can see it seeks to Python 2.6.6 library. But I need to work with python 2.7.3. Can anyone help me to get rid of it?
Actually I don't know if Apache is configured well or not!
I'm on CentOS 6.2.
Have a look at this. However, note this part:
If you want to use a different version of major/minor version of Python than currently used, you must recompile mod_wsgi against the alternate version of Python.
I'm not quite sure that if you simply swap the WSGIPythonHome variable it will work. If you have installed mod_wsgi with yum, you will probably have a mod_wsgi for Python 2.6.x, which is distributed with CentOS 6.x. If you really want to use Python 2.7.x, you may have to build mod_wsgi from source (which is actually not that hard).

Categories

Resources