Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using turnkey image for python django http://www.turnkeylinux.org/django

When i open the page by ip adress the home page open ok

Now i tried to made the simple python file inside the wwwroot to check but apache is not executing it. it asks me to download it

THe code of file is

#!/usr/bin/env python

print "Content-Type: text/plain\n\n"
print 'Hello, world!\n' 

Its the pre made vmware image and django is working. How can i check my example

share|improve this question
add comment

3 Answers

By default, CGI scripts must be placed in cgi-bin/, must be executable, and must not be world-writable.

share|improve this answer
    
DO you mean i have to create a folder called cgi-bin because currently the default directory of django is /var/www/django-sites/httpdocs . i just want to display hello on web browser. Also then how can i see the django site , i think that is also python and that is not insdie cgi-bin. –  John Jun 23 '10 at 3:32
add comment

Django doesn't run as CGI. Grep around /etc/apache2 to see where /var/www/django-sites/apps is configured. The configuration file should be named /etc/apache2/sites-enabled/django or similar, and Django is configured with a WSGIScriptAlias directive.

share|improve this answer
add comment

chmod 755 the script

If that doesn't work, try putting the following in .htaccess:

Options +ExecCGI
AddHandler cgi-script .cgi 

If that doesn't work, try putting those in a Directory block in your VirtualHost config and restart apache:

<Directory /path/to/webroot/>
Options +ExecCGI
AddHandler cgi-script .cgi 
</Directory>

Then you need to do:

VirtualHost Config:

<Directory /path/to/webroot/>
Options +ExecCGI
AddHandler wsgi-script .wsgi
</Directory>

test.wsgi def application(environ, start_response): start_response('200 OK',[('Content-type','text/html')]) return ['Hello World!']

share|improve this answer
    
i will try that but one thing worries me is that i want to run python via web using mod_wsgi , why i need to enable cgi-bin for that –  John Jun 23 '10 at 6:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.