| Home  | Casa  | Hardware  | Networking  | Programmazione  | Software  | Domanda  | Sistemi  |   
Programmazione  
  • C /C + + Programming

  • Computer Programming Languages

  • Delphi Programming

  • Java Programming

  • Programmazione Javascript

  • PHP /MySQL Programmazione

  • Perl Programming

  • Python Programming

  • rubino Programmazione

  • Nozioni di base di Visual Programming
  •  
    Conoscenza Informatica >> Programmazione >> Python Programming >> Content
    Come incorporare Python in HTML
    A differenza di JavaScript , il codice Python può non da direttamente incorporato nel codice HTML , ma può essere invocata attraverso il gateway comune interfaccia di scripting , dove compete con il linguaggio di scripting Perl per le attenzioni dei programmatori web di muovere i primi passi in interattiva applicazioni web . Framework web /Python robusti come Django e Zope offrono i programmatori Python potenti strumenti per la creazione di applicazioni web dove la logica di programmazione e visualizzazione html sono conservati a parte . Questi sistemi offrono potenza e la scalabilità . Cose che ti serviranno
    Apache Web Server applicazione
    Python 2.6 o superiore
    Show More Istruzioni
    1

    Configurare il web server Apache di eseguire script CGI inserendo il seguenti righe di codice nel file httpd.conf principale :


    Opzioni

    + ExecCGI

    < /directory >

    sarà inoltre necessario aggiungere la seguente riga al file httpd.conf : . .

    AddHandler cgi-script cgi py

    Questo indica al server web che i file aggiunti con CGI e py deve essere eseguito come script CGI
    2

    Aprire un editor di testo e digitare quanto segue: . . . !

    # /usr /bin /python < br

    stampa > ( ' Content-type: text /html \\ n' ) print ( ' Python_In_HTML < /TITLE >' ) print ( ' <H1> Python vorrebbe dire </h1 >' ) print (' <P> Ciao , HTML < /P > ! ' ) per <p> la prima linea con il suo invito " baracca " invoca l'interprete Python , il comando di stampa chiama il metodo html in modo che il testo tra i tag verranno formattati correttamente nel browser . Salvare il file come PyScript1.py in root /Library /Apache /cgi- bin <br> 3 <p> Prova lo script , aprire un browser Web e digitare il seguente URL : . <br> < p > http://localhost.cgi-bin.PyScript1.py <br> <p> Il tuo browser visualizzerà la seguente : Python vorrebbe dire Ciao , HTML <br> <br> <div class=ad2><script language='javascript' src='/ad/201310/4.js'></script></div> </div> </td> </tr> </table> <table width="95%" height="1" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#DEE7EE"> <tr> <td></td> </tr> </table> <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> </table> <table width="91%" height="52" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="51%"><p>Previous : <a class='LinkPrevArticle' href='/Programmazione/python-programming/93773.html' >Come visualizzare un URL Uso di espressioni regolari </a></li></p></td> </tr> <tr> <td width="49%"> next : <a class='LinkNextArticle' href='/Programmazione/python-programming/93775.html' >Qual è la differenza tra il Dot Notation & Freccia notazione in C ? </a></li></td> </tr> </table></td> </tr> </table> <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> </table> <table width="770" height="246" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="375" height="246" valign="top"><table width="380" border="0" cellpadding="0" cellspacing="0" class="bian"> <tr> <td height="244" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="img_dm/danmai_r4_c04 -.jpg" bgcolor="#DBE3EE"> <tr> <td width="4%" height="29"> </td> <td width="96%" class="lan_lm"> Articoli Correlati </td> </tr> </table> <table width="95%" height="209" border="0" align="center" cellpadding="0" cellspacing="4"> <tr> <td height="201"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93805.html" title="Come importare una classe Python Da una shell interattiva " target="_self">Come importare una classe Python Da una shell interatti…</a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93819.html" title="Quali programmi utilizzano Python " target="_self">Quali programmi utilizzano Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93984.html" title="Come rimuovere i parametri in una stringa Python " target="_self">Come rimuovere i parametri in una stringa Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93584.html" title="Come accedere alla prova Tempo di esecuzione in Python " target="_self">Come accedere alla prova Tempo di esecuzione in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93971.html" title="Come convertire da RGB a HSL in Python " target="_self">Come convertire da RGB a HSL in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93483.html" title="Come codice di Nim per Python " target="_self">Come codice di Nim per Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93796.html" title="Python Ordina Funzione " target="_self">Python Ordina Funzione </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93729.html" title="Come ottenere Python per ottenere un output dell'immagine " target="_self">Come ottenere Python per ottenere un output dell'immagi…</a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93913.html" title="Orientata agli oggetti Python Tutorial " target="_self">Orientata agli oggetti Python Tutorial </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93830.html" title="Come posso controllare il rientro Python in VIM " target="_self">Come posso controllare il rientro Python in VIM </a></td></tr><tr></tr></table></td> </tr> </table></td> </tr> </table></td> <td width="20" valign="top"></td> <td width="375" valign="top"><table width="380" border="0" cellpadding="0" cellspacing="0" class="bian"> <tr> <td height="244" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="img_dm/danmai_r4_c04 -.jpg" bgcolor="#DBE3EE"> <tr> <td width="4%" height="29"> </td> <td width="96%" class="lan_lm">Articoli in evidenza </td> </tr> </table> <table width="95%" height="207" border="0" align="center" cellpadding="0" cellspacing="4"> <tr> <td height="199"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/php-mysql-programming/92326.html" title="Come scrivere ottali di numeri in PHP " target="_self">Come scrivere ottali di numeri in PHP </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/computer-programming-languages/88105.html" title="Come aggiungere controlli a un pannello " target="_self">Come aggiungere controlli a un pannello </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/computer-programming-languages/87429.html" title="Come utilizzare un mouse in QBasic " target="_self">Come utilizzare un mouse in QBasic </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/php-mysql-programming/91743.html" title="Tutorial PHP per le funzioni di stringa " target="_self">Tutorial PHP per le funzioni di stringa </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/visual-basics-programming/94453.html" title="Come nascondere un controllo Ribbon Da VBA " target="_self">Come nascondere un controllo Ribbon Da VBA </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/visual-basics-programming/94883.html" title="Modo efficace per dividere stringhe in VB.NET " target="_self">Modo efficace per dividere stringhe in VB.NET </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/visual-basics-programming/95105.html" title="Come modificare una PictureBox immagine in codice VB " target="_self">Come modificare una PictureBox immagine in codice VB </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/java-programming/90292.html" title="Come creare un semplice servizio Web in Apache Tomcat " target="_self">Come creare un semplice servizio Web in Apache Tomcat </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/visual-basics-programming/95132.html" title="Come usare una DLL in VB.NET " target="_self">Come usare una DLL in VB.NET </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/computer-programming-languages/87825.html" title="Svantaggi e vantaggi di compilatori " target="_self">Svantaggi e vantaggi di compilatori </a></td></tr><tr></tr></table></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> </table> <table width="980" height="8" border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> </table> <table border=0 cellSpacing=0 cellPadding=0 width=980 bgColor=#36506e height=90> <tr> <td class=bs height=90 align=middle>Copyright © Conoscenza Informatica http://it.wingwit.com <script language='javascript' src='/ad/201310/1.js'></script></td> </tr> </table> </div> </body> </html>