On my development system, I have Python 2.6, Django 1.1 and GAE.
I have three projects running on Python 2.6 and Django 1.1.
I have 1 project using GAE, Python 2.6 and Django 1.1.
I have heard that my set-up for running GAE using Python 2.6 may create some head-scratching problems while deploying it on the production server, because GAE supports only Python 2.5, and using 2.6 is not recommended.
Can I develop GAE application using Python 2.6? If not, what should I do? I am using Windows Vista as my development system.
Please note : I don't want to disturb my other projects in development, which uses Python 2.6 and Django 1.1.
Use virtualenv to isolate your development environments, so you can have one running 2.5 and the others running 2.6.
Edited to add: once 2.5 is installed, you can initialize your virtualenv to use it with the -p option:
virtualenv -p /path/to/python2.5/python.exe destination_dir
Unless you are using python 2.6 specific syntax/code your application is safe to run on GAE.
Re virtualenv question above: virtualenv have a parameter
--python=PYTHON_EXE that you can point to the interpreter you'd like
it to use. Running virtualenv without parameters or with an --help
option whill show you which options you may pass it.
Related
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.
Could you please let me know the best way to upgrade python on linux? I need it because my redhat linux machine is offering 2.6.6 version as default. If I install python 2.7 then it breaks yum and mod_wsgi. Has anyone found out the best way to do it? I really need this for flask web development.
I had tried https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/ steps but it caused issues with mod_wsgi (which was on 2.6).
Just to add - I have read and tried almost everything related to this topic but couldn't succeed. Hence I am asking this question if someone has already figured out a way for this.
In addition to what SpliFF said, you can create a virtual environment and set which python version you would like to use by using the -p flag.
You can install multiple versions of python side-by-side. What makes one "default" is the python and python2 symlinks in /usr/bin.
However you should definitely not change the default python on Redhat for the reasons you list and more.
Instead, you will need to tell WSGI which python to use. This question covers that: Run mod_wsgi with virtualenv or Python with version different that system default
Also, according to this answer ( Deploying Python Flask App on Apache with Python version installed in Virtual Environment Only ) you may need to compile a custom wsgi against the python version you want to use.
For RedHat based operating systems, use SCL versions of Python.
https://www.softwarecollections.org/en/
They are installed in separate area so they do not conflict.
There is no mod_wsgi in SCL, so use pip method to install it and then link Apache to it. Details in:
https://pypi.python.org/pypi/mod_wsgi
Hi there I was recently developing an application on openshift.
I used the Python 3.3 Cartridge together with Django. And there is the problem. Because of the "old" version of python I get some exceptions. (Which is indeed a problem with the python version, because i tested it with python 3.3.2 on my local computer.)
My question is know is it possible to make an custom cartridge with pyhton 3.4? Or even update the existing python cartridge?
If yes, how does it work?
It might be possible to create a custom cartridge that has python 3.4. You would need to ssh into a gear on OpenShift Online (or use a compatible local RHEL or CentOS installation) to compile python 3.4 and it's dependencies, then you can use the Cartridge Developers Guide (https://docs.openshift.org/origin-m4/oo_cartridge_developers_guide.html) to create a cartridge that you can install it with.
You can also add it as a request at https://openshift.uservoice.com and get other users to vote on it.
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.)
One of my sites requires python and cherrypy. Locally, I need to get all of this running with MAMP. I have the site running in MAMP with the exception of features reliant on Python. I need to run python 2.5. My OS version is 2.7.
How do I set this up? I seem to have 2.5 installed in addition to 2.7 and 2.6
which python
/usr/bin/python
which python2.5
/usr/bin/python2.5
but the usr/bin/python2.5 is an alias to: System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
How do I make python2.5 available to MAMP without screwing up the vers OSX needs?
It's a drupal site, MAMP is handling everything php related, and perhaps I wrongfully assumed it needed to have anything to do with the python scripts of the site. As I read more about cherrypy, it seems cherrypy serves the python scripts, and I do have cherrypy running (localhost:8080 test works anyway), so perhaps all I need to do is make sure python2.5 is being used instead of the default? (2.7)
You've got the right idea. You definitely want to leave the OS python version alone. Or you could be breaking multiple dependencies. We launch our cherrypy instances in our rc.local script at boot. This is where you specify which version of python to use when executing your cherrypy app.
Our rc.local script looks like this:
/opt/Python-3.2/python /var/www/html/appname/webapp.py > stdout.log &