Skip to content

rohitksingh/Flask-Code-Repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask: Getting Started

Documentation

Minimal Application

app = Flask(__name__)

@app.route('/')
def hello_world():
  return 'Hello, World!'

Running flask application?

$ export FLASK_APP=hello.py
$ flask run

DEBUG=TRUE so that you dont need to start the server over and over when there is a change

$ export FLASK_DEBUG=1
$ flask run

or add this

if __name__ == '__main__':
app.run(host='127.0.0.1',port=4455,debug=True)   // Changed port number (Not needed)

Output:

Screenshot 2020-06-29 at 9 02 02 PM

How to resolve Server is already in use error?

kill -9 `lsof -i:5000 -t`

How to add Login Page?

  • Create Python class
  • Add {{form.username(class="form-control form-control-lg")}}
  • Add methods=['GET', 'POST'] in register route
  • Adding Flash message

After App Restrucure

Screenshot 2020-07-03 at 4 44 24 PM



About author

This Repository is developed and maintained by

Rohit Singh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published