SUPPORT


Running Flask Demos




The VM comes with working Flask demos from the exercises of the course “Python and Flask Bootcamp: Create Websites using Flask” by Jose Portilla on Udemy

All the demos are available under home/coder/django-flask-suit/flask-example-projects/

/img/common/python-django-flask-common-images/flask-demo-location.png

Follow below steps to run the demos:

  • First , go to the demo directory , for example cd /home/coder/django-flask-suit/flask-example-projects/Flask-Bootcamp-master/02-Flask-Basics

  • /img/common/python-django-flask-common-images/cd-flask-directory.png

  • Then switch to the super user. This is required to run Flask server on port 80
    sudo su

  • /img/common/python-django-flask-common-images/flask-sudo-su.png

  • Then set the FLASK_APP environment variable to the app file
    export FLASK_APP=06-Routing-Exercise-Solution.py

  • /img/common/python-django-flask-common-images/flask-env-variable.png

  • Then start the flask server by running below command
    flask run -h 0.0.0.0 -p 80

  • /img/common/python-django-flask-common-images/run-flask-server.png

  • After running the command, open http://publicip and you should see the demo page displayed

  • /img/common/python-django-flask-common-images/flask-home-page.png

    /img/common/python-django-flask-common-images/flask-home-page-02.png