3/31/2024 0 Comments Byte back typing tutorialThe Debug Mode is very helpful during early development, but should be switched off for public applications. It requires no setup at all and is an incredibly painless way to get your application up and running for local tests. You can switch the server backend later, but for now a development server is all we need. It runs on localhost port 8080 and serves requests until you hit Control-c. The run() call in the last line starts a built-in development server. Whenever a browser requests an URL, the associated function is called and the return value is sent back to the browser. You can define as many routes as you want. This is called a route (hence the decorator name) and is the most important concept of this framework. In this case, we link the /hello path to the hello() function. The route() decorator binds a piece of code to an URL path. Run this script, visit and you will see “Hello World!” in your browser. From bottle import route, run ( '/hello' ) def hello (): return "Hello World!" run ( host = 'localhost', port = 8080, debug = True )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |