How to test for python support in a web host
Asked Answered
F

2

7

Hello a client of mine bought a pretty bad web host and i don't even have ssh access, their ticket suport only answered with "yes we support python in our servers" but i can't run any .cgi .py or application.wsgi files. is there a sure way to tell if the server supports python? I only have access to the ftp and the directadmin interface, i would like to know more before i can complaing again to their support system otherwise they will not pay attention.

The host is neubox.net this is what i already tried. This tutorial http://www.howtoforge.com/embedding-python-in-apache2-with-mod_python-debian-etch worked on my dev machine, it says that i need to add a webhost in the apache2 /available-sites dir but obviously i don't have access to that folder in the hosting. I also tried putting this script on the root of my host, called application.wsgi it didnt work

import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I also tried this file application.py on the root

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print "Content-Type: text/plain;charset=utf-8"
print

print "Hello World!"

Those files were shown as plain text, i tried that exact same code but named application.cgi and oddly enough it returned a 404 error, the file of course its there. I saw at the directadmin interface in site summary that CGI-Bin OFF So i guess thats the reason for the 404. In the same page i see that the name servers are http://ns115.neubox.net/ http://ns116.neubox.net The first one says Apache is functioning normally This is their services comparison site (spanish) http://neubox.net/comparativo-hosting.php

I wish i could know what OS are they running i'm almost sure is linux because on my root there is a folder .htpasswd and those .folders are linux for hidden, but i'm not sure if thats a sure way to tell.

They gave me this url http://72.249.55.33/info.php its for phpinfo() i see fast-cgi but all the tuts about it talk about doing things like changing Apache configuration wich i obviously can't do, this is the end of my search right? they do not support python.

Fatima answered 22/7, 2011 at 21:37 Comment(1)
can you tell us the name of the host? or more info about, windows? linux? if linux wich distro? con we see your script? have you modified .htaccses?Uird
U
9

In your server thay sais that they have php, so maybe you can use this php function. to retrive more info, executing a python script:

# hacking.py
import sys
print sys.version_info

and after you make something like this

<?php
// echo $path = exec('pwd');

// exec python script
echo exec('python hacking.py');
?>

dont forget the file permissions

Uird answered 23/7, 2011 at 0:15 Comment(6)
i got a 500 error code, and additionaly a 404, i tried opening the root directly and then trying to access the file application.py directly. Does it matter if its not the root of the site?Fatima
no it does not matter, but you should change the perms to the file to execute, something like 644, of even just try 777, i know that you don't has access to the server via ssh, but maybe they have some interface todo this. Anyway i'm passing a phone call tomorrow iḿ interested on thisUird
I gave it 777 and it didn't worked, its a marketing gimmic, they don't support python, at least not the moment.Fatima
i changed my answer, i hope this can help youUird
Warning: exec() has been disabled for security reasons in /home/whiterab/dev/pythontest/pythontest.php on line 5Byron
try with fcgi, is a real pain but if you can´t move from your server some times is the only optionUird
B
2

sacabuche has the correct answer. That script is a very simple way to test for Python support. It works on pretty much every flavor of linux and Berkely UNIX (BSD), a version of which is underlying OSX on a Mac Pro. If that script is not working for you, chances are it's a permissions issue.

I would continue working through the support staff on the host to get this resolved. If they can't help, you've got the wrong host. I've changed hosts several time due to lack of support, or misrepresented features, such as separate folder hierarchies per domain... something that's getting increasingly hard to find.

Currently I am on MochaHost, which I do recommend, since they seem to have it all together so far.

-Jack

Bellda answered 15/1, 2012 at 16:47 Comment(3)
Thanks, i moved to webfaction as they have awesome python/django support.Fatima
@GuillermoSiliceoTrueba But the thing it's not free :(Razo
@Razo you can always use Heroku, its free :) with python support.Fatima

© 2022 - 2024 — McMap. All rights reserved.