Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
893 connectés 

  FORUM HardWare.fr
  Programmation
  Python

  [Python ] Module CGIHTTPServer

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Python ] Module CGIHTTPServer

n°804144
chaica
Posté le 23-07-2004 à 11:18:31  profilanswer
 

Voilà j'essaie de réaliser une appli avec son propre serveur http qui gère les cgi.
 
Je lance donc mon serveur http puis j'appelle avec mon navigateur le script en lui-même. Et là j'ai un comportement assez bizarre il n'interprète ni les images ni le fichier css.
 

[localhost - - [23/Jul/2004 11:08:59] "GET /cgi-bin/webadmin.py HTTP/1.1" 200 -
localhost - - [23/Jul/2004 11:08:59] code 403, message CGI script is not executable ('/cgi-bin/main.css')
localhost - - [23/Jul/2004 11:08:59] "GET /cgi-bin/main.css HTTP/1.1" 403 -
localhost - - [23/Jul/2004 11:08:59] code 403, message CGI script is not executable ('/cgi-bin/download_server.png')
localhost - - [23/Jul/2004 11:08:59] "GET /cgi-bin/download_server.png HTTP/1.1" 403 -


 
Le serveur :

Code :
  1. import SimpleHTTPServer
  2. import CGIHTTPServer
  3. import BaseHTTPServer
  4. import sys
  5. import socket
  6. UROOT = 'Are-you root?'
  7. DENIEDPERM = 'Permission denied'
  8. SYNTAX = 'Correct syntax : $webgamelauncher.py nbport'
  9. class WebGameLauncher( CGIHTTPServer.CGIHTTPRequestHandler, BaseHTTPServer.HTTPServer  ):
  10. def __init__( self, HandlerClass = CGIHTTPServer.CGIHTTPRequestHandler,
  11.  ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0" ):
  12.  try:
  13.   if len( sys.argv ) < 2 :
  14.    print SYNTAX
  15.   else:
  16.    port = int( sys.argv[ 1 ] )
  17.    server_address = ( '', port )
  18.    HandlerClass.protocol_version = protocol
  19.    httpd = ServerClass( server_address, HandlerClass )
  20.    sa = httpd.socket.getsockname()
  21.    print "Serving HTTP on", sa[ 0 ], "port", sa[ 1 ], "..."
  22.    httpd.serve_forever()
  23.  except KeyboardInterrupt, msg:
  24.   print msg
  25.  except socket.error, msg:
  26.   print msg
  27.   if msg[ 1 ] == DENIEDPERM :
  28.    print UROOT
  29. if __name__ == '__main__':
  30. WebGameLauncher()


 
Je vois pas trop comme ça.


Message édité par chaica le 23-07-2004 à 11:18:55
mood
Publicité
Posté le 23-07-2004 à 11:18:31  profilanswer
 

n°804473
chaica
Posté le 23-07-2004 à 14:40:42  profilanswer
 

up!


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

  [Python ] Module CGIHTTPServer

 

Sujets relatifs
foxserv python mysqlPeut on créer des IHM avec python?
Python et tests...Ouvrir fichier PDF avec python ?
[Python][ZODB] récuperer les attributs d'un objet par reflexivité[Python] TypeError sur une concaténation de chaines [Résolu]
Lister toutes les fonctions et classes d' un module[python] Regex : substitution
Problème d' installation d' un module perl avec CPANHeuuu ! python c'est quoi et c'est utile dans quoi?
Plus de sujets relatifs à : [Python ] Module CGIHTTPServer


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR