CodeSolved

Solved Programming Questions & Exercises

My first page

Practice Easy 1624/ Download 477 Views

Write a program that shows the sentence "My First Page" at the URL address below

127.0.0.1:8000/mainpage/

2 Answers

from flask import Flask
app = Flask(__name__)

@app.route("/mainpage")
def mainpage():
    return "اولین صفحه ی من"

if __name__ == "__main__":
    app.run()
User 49 Download Python

You can use the Flasc in Python to display the sentence "My First Page" at the specified URL. See the following code:

from flask import Flask

app = Flask(__name__)

@app.route('/mainpage/')
def main_page():
    return "اولین صفحه‌ی من"

if __name__ == '__main__':
    app.run(debug=True, host='127.0.0.1', port=8000)

This code sets up a local server that at the address127.0.0.1:8000/mainpage/Displays the sentence.

Ai Download Python

Submit answer

Submitting answers is currently unavailable.

×
×
Close