यदि आप अपने कंप्यूटर का उपयोग कर रहे हैं, तो XAMPP (या WAMPP या तो काम करता है) नामक एक सॉफ्टवेयर स्थापित करें। यह मूल रूप से एक वेबसाइट सर्वर है जो केवल आपके कंप्यूटर पर चलता है। फिर, एक बार यह स्थापित हो जाने पर, xampp फ़ोल्डर पर जाएं और htdocs फ़ोल्डर को डबल क्लिक करें। अब आपको एक HTML फ़ाइल बनाना है (मैं इसे runpython.html कहूंगा)। (और साथ htdocs को अजगर फ़ाइल स्थानांतरित करने के लिए याद रखें)
(आवश्यक के रूप में इनपुट और) अपने html शरीर को यह में जोड़े
<form action = "file_name.py" method = "POST">
<input type = "submit" value = "Run the Program!!!">
</form>
अब, अजगर फ़ाइल में, हम मूल रूप से मुद्रण होने जा रहे हैं एचटीएमएल कोड बाहर।
#We will need a comment here depending on your server. It is basically telling the server where your python.exe is in order to interpret the language. The server is too lazy to do it itself.
import cgitb
import cgi
cgitb.enable() #This will show any errors on your webpage
inputs = cgi.FieldStorage() #REMEMBER: We do not have inputs, simply a button to run the program. In order to get inputs, give each one a name and call it by inputs['insert_name']
print "Content-type: text/html" #We are using HTML, so we need to tell the server
print #Just do it because it is in the tutorial :P
print "<title> MyPythonWebpage </title>"
print "Whatever you would like to print goes here, preferably in between tags to make it look nice"
यह पाइथन नहीं है, आपको पाइथन वेब फ्रेमवर्क ई, जी, वेबपी या डीजेंगो आदि स्थापित करना होगा, और mod_python के साथ एपैश कॉन्फ़िगर करना होगा। –
व्हिस्की आज़माएं !! : डी "डब्लूएसजीआई" (वेब सर्वर गेटवे इंटरफ़ेस)। – Arunmu
पजामा और मूर्तिकला जैसे ढांचे का उपयोग करके एक वेब पेज (क्लाइंट साइड पर) पाइथन को चलाने के लिए संभव है। –