If you are completely new to python then here is the answer for your obvious question what is python and why to learn!
In this tutorial we learn how to create python web application using Bottle Framework with Visual Studio.
Before we start developing our first python web application using visual studio, here are two quick prerequisites
We will create our first python web application using bottle framework in visual studio
Bottle: Python Web Framework will be installed and local environment step up will be done.
All necessary packages for Python application development will be downloaded and installed in local environment
Finally this is how python application structure will look like
Now you can simply run the python web application in your local machine
After creating a new view, register the view in routes .py file, like the way we have registered our new tutorial view , here is the code
@route('/tutorial') @view('tutorial') def tutorial(): """Renders the about page.""" return dict( title='Python Tutorial', message='Things to learn in Python', year=datetime.now().year )
In view we can write python code mixing with html code, (the same way we used to write in Php or razor pages)
Python class extension is .py, see the “routes.py“ in above solution, after creating any new class we must compile solution to use the functionality
Like any other web application, in python also we can create any number of master pages or layout pages, layout page has same extension like view, and we can give any name to master page / layout page
% rebase('layout.tpl', title='Tutorial Page', year=year)Another way to add master page reference
{% extends "app/layout.html" %}
This is how content placeholder is defined in Bootle framework layout page
{{!base}}
So far you learned creating a basic python web application!
Now let’s take a quick look at some of very useful tutorial about python development before we start with some real-time example
Hope you can start playing with bottle framework