Click here to Skip to main content
15,122,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a program in python, which is an online store which users can add products to their cart and checkout etc.

For the final part I want to finish it with it set up in flask for its own web page.

        <pre lang="Python">
        from flask import Flask
        from delivery import *
        app = Flask(__name__)


        class Main():
             def StartMessage(self):
                 while True:
                              Welcome to The Toy Store

                             Please select which action you would like:
                             1. View store products
                             2. Add item to Shopping Cart
                             3. View Shopping Cart
                             4. Remove item from Shopping Cart
                             5. Calculate Shopping Cart
                             6. Checkout
                             7. Delivery 
                             8. Check product availability
                             9. Exit

                     selection = int(input("Select which action: "))

                     if selection == 1:

                     elif selection == 2:

                     elif selection == 3:

                     elif selection == 4:

                     elif selection == 5:

                     elif selection == 6:

                     elif selection == 7:

                     elif selection == 8:

                     elif selection == 9:
                        print(" Thank you for visiting The Toy Store, we hope to see you again")

                       print("Invalid selection, please try again")

        startmessage = Main()

What I have tried:

Looking online for various tutorials I managed to get the obligatory hello world response on the webpage, I thought if I changes this to add my start message function which welcomes users and lets them pick which action to take it would start on a webpage, however running this the function just works inside the terminal it does not provide the flask root to open up a web page.
Updated 22-Oct-21 4:15am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900