Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mod-python in apache2 on debian 9
#1
I have tried by following a howto to enable mod-python in apache2 on debian 9

I followed how to test if it was succesful , and at this stage cannot find a succesfull end

at the moment apache log tells me

[Mon Jun 08 15:41:36.065959 2020] [:error] [pid 7631:tid 140025935138880] python_init: Python version mismatch, expected '2.7.5+', found '2.7.13'.
[Mon Jun 08 15:41:36.066045 2020] [:error] [pid 7631:tid 140025935138880] python_init: Python executable found '/usr/bin/python'.
[Mon Jun 08 15:41:36.066049 2020] [:error] [pid 7631:tid 140025935138880] python_init: Python path being used '/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload'.
[Mon Jun 08 15:41:36.066056 2020] [:notice] [pid 7631:tid 140025935138880] mod_python: Creating 8 session mutexes based on 6 max processes and 25 max threads.
[Mon Jun 08 15:41:36.066059 2020] [:notice] [pid 7631:tid 140025935138880] mod_python: using mutex_directory /tmp
[Mon Jun 08 15:41:37.004647 2020] [mpm_event:notice] [pid 7631:tid 140025935138880] AH00489: Apache/2.4.25 (Debian) mod_python/3.3.1 Python/2.7.13 configured -- resuming normal operations
[Mon Jun 08 15:41:37.004794 2020] [core:notice] [pid 7631:tid 140025935138880] AH00094: Command line: '/usr/sbin/apache2'
Reply
#2
Hi

Well the first error message I would have thought is self explanatory, the debian apache version you are using requires 2.7.5 and you have 2.7.13, so one might assume that it is very specific about the version it needs or that the apache implementation is incorrect in being so specific, second part would be why it needs to use what in effect is a out of support version now, so maybe try a different web server implementaion?
Can I ask why debian 9 - stretch release is like 3+ years old now, or is this not in your control?
If this is a private Debian then what about installing VirtualBox and creating a guest with something more recently supported like Ubuntu which is debian orientated, there you will have later apache version and python.

The other option on your debian is that you could use something like pyenv and install python 2.7.5 set as your "local version" and then install apache perhaps over that?
Regards
-------- *
“Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.”
Reply
#3
https://wiki.debian.org/DebianReleases
End of life for Debian 9 is 2020-07-06

from datetime import date
print((date.fromisoformat("2020-07-06") - date.today()).days, "days left to update Debian 9")
Output:
27 days left to update Debian 9
Then Python 2 is deprecated since 2020-01-01: https://pythonclock.org/

2008 people asked to deprecate mod_python: https://groups.google.com/forum/#!topic/...cXeK5luL0k
2013 Ubuntu deprecated mod_python: https://bugs.launchpad.net/ubuntu/+sourc...ug/1104339

You should avoid:
  • Python 2.x
  • mod_python

Use instead mod_wsgi: http://terokarvinen.com/2017/write-pytho...separately

Here is an example with Flask: https://www.codementor.io/@abhishake/min...-phu50a7ft

I prefer uwsgi + nginx.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
(Jun-09-2020, 09:20 AM)DeaD_EyE Wrote: I prefer uwsgi + nginx.
That's a good combination.
I have used Gunicorn and Nginx.
In general these setup is the most preferred and easy to setup for Python web-frameworks.

Digital Ocean guides are good and updatet can be applied elsewhere even if not use DO,
as start from blank distro eg Ubuntu 16-20, Debian 8-10...ect.
Examples.
How To Serve Flask Applications with Gunicorn and Nginx on Ubuntu 20.04
How To Set Up Django with Postgres, Nginx, and Gunicorn on Debian 10
How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 20.04
Reply
#5
Thanks to all who have posted in this thread its been a big help

It seems that mod-python in apache2 is now almost finished and the suggested replacement mod-wsgi

The reason for the need to use mod-python is that a python progamme written back in 2010 needs mod-python
the programme is available as a source tar.gz file and as a python.egg if that is the correct term which can be installed with setuptools.

However I must find out if this programme is compatible with mod-wsgi.
Reply
#6
(Jun-09-2020, 03:56 PM)xstation Wrote: Thanks to all who have posted in this thread its been a big help

It seems that mod-python in apache2 is now almost finished and the suggested replacement mod-wsgi

The reason for the need to use mod-python is that a python progamme written back in 2010 needs mod-python
the programme is available as a source tar.gz file and as a python.egg if that is the correct term which can be installed with setuptools.

However I must find out if this programme is compatible with mod-wsgi.
Almost forgot here is python programme l am talking about
http://pyanon.sourceforge.net
Reply
#7
Two options: Rewrite or finding a replacement for it.

Rewriting it for Python 3 + uwsgi should not take much time.
Most things are today easier and for example flask makes it easy.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Debian 10 Buster Environment - Python 3.x (MariaDB 10.4.21) | Working Connector? BrandonKastning 9 4,122 Jan-04-2022, 08:27 PM
Last Post: BrandonKastning
  Getting Flask to run on an apache2 SuchtyTV 2 2,054 Sep-17-2020, 08:05 PM
Last Post: SuchtyTV
  How to deploy Django application on Apache2 server deepag 0 2,005 Jan-23-2019, 05:09 AM
Last Post: deepag
  debian/ubuntu apt program jtmtman 1 4,071 Oct-24-2016, 07:03 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020