Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51387
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-07-28 09:19 -0700 |
| References | <2ebe3375-6aa6-45cd-b534-0241bd025eb3@googlegroups.com> <87r4ei5358.fsf@silissia.kaiyou.fr> |
| Message-ID | <b4cbe2d0-1df3-472a-b6ed-7361256c0ebc@googlegroups.com> (permalink) |
| Subject | Re: Configuraion to run pyhton script on ubuntu 12.04 |
| From | Jaiky <jaiprakashsingh213@gmail.com> |
Sir i already tried this "Alias" concept
I did the following steps
===============================================================================
Step 1:
added
"ScriptAlias /cgi-bin/ /var/www/cgi-bin/"
in /etc/apache2/sites-available/default
============================================================================
step 2:-
added :-
def main():
app.run()
if __name__ == '__main__':
main()
in /var/www/cgi-bin/hello_world.py
================================================================================
Now my Configuration of /etc/apache2/sites-available/default in under
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
AddHandler mod_python .py
PythonHandler mod_python.publisher | .py
AddHandler mod_python .psp .psp_
PythonHandler mod_python.psp | .psp .psp
</Directory>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin/">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride None
Order allow,deny
allow from all
AddHandler cgi-script cgi pl
</Directory>
#ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AddHandler cgi-script cgi pl
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
===============================================================================
my code is under /var/www/cgi-bin/hello_world.py
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
def main():
app.run()
if __name__ == '__main__':
main()
=============================================================================
extra thing i did
in /etc/apache2/mods-available/mod_python.conf
where i created the file "mod_python.conf"
<IfModule mod_python.c>
AddHandler mod_python .py .psp
PythonHandler mod_python.publisher | .py
PythonHandler mod_python.psp | .psp
</IfModule>
################################################################################
when i run localhost/cgi-bin/hello_world.py
error i get
Not Found
The requested URL /cgi-bin/hello_world.py was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
#############################################################################
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Configuraion to run pyhton script on ubuntu 12.04 Jaiky <jaiprakashsingh213@gmail.com> - 2013-07-28 03:32 -0700
Re: Configuraion to run pyhton script on ubuntu 12.04 Pierre Jaury <pierre@jaury.eu> - 2013-07-28 13:34 +0200
Re: Configuraion to run pyhton script on ubuntu 12.04 Jaiky <jaiprakashsingh213@gmail.com> - 2013-07-28 09:19 -0700
Re: Configuraion to run pyhton script on ubuntu 12.04 Jaiky <jaiprakashsingh213@gmail.com> - 2013-07-29 03:44 -0700
csiph-web