Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test for python support in a web host

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.

like image 409
Guillermo Siliceo Trueba Avatar asked Jul 22 '11 21:07

Guillermo Siliceo Trueba


People also ask

How do I know if my server supports Python?

Originally Answered: How do I know if my web server can run Python on it? Type "help", "copyright", "credits" or "license" for more information. Again, this should show up on a Windows server as well as a Linux server (or any other operating system, really).

Can you host Python on a website?

All they need to interact with your code is a browser and an Internet connection. Getting Python to run on a website can be complicated, but there are a number of different web frameworks that automatically take care of the details. As mentioned above, you'll build a basic Flask application in this tutorial.


1 Answers

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

like image 89
sacabuche Avatar answered Nov 08 '22 23:11

sacabuche