Hello guys, Welcome to my personal blog.
In this tutorial, I want to share some knowledge of Flask.
First of all, I would like to introduce myself. My name is Nyamkhuu. I am a software developer. I am writing code in Java, almost every day. But I want to learn a python programming language. So, I decided to start a blog while learning. If you don't know about the Flask, don't worry. I am a beginner too. 😃
Before start coding, I would try to explain through my words what is flask. The flask is a web application framework but lightweight more than the Django. Then, easy to use and learn, in my opinion. But now, Let's see the official definition.
First, We should create a project folder and virtual environment folder within:
On windows:
So, we should activate our virtual environment.
That's it our configure. We already begin to write some code.
So, you can use your favorite code editor. In my case, I want to use Vim. :D
First, we should create a new python script file. Just save it as First.py or something similar.
Here's my First.py:
That's it my first tutorial. See you guys. Enjoy :D :)
In this tutorial, I want to share some knowledge of Flask.
First of all, I would like to introduce myself. My name is Nyamkhuu. I am a software developer. I am writing code in Java, almost every day. But I want to learn a python programming language. So, I decided to start a blog while learning. If you don't know about the Flask, don't worry. I am a beginner too. 😃
Before start coding, I would try to explain through my words what is flask. The flask is a web application framework but lightweight more than the Django. Then, easy to use and learn, in my opinion. But now, Let's see the official definition.
Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as a simple wrapper around Werkzeug and Jinja and has become one of the most popular Python web application frameworks.
If you want to visit the official website of the flask. click there
So, Let's get start coding 😃😃First, We should create a project folder and virtual environment folder within:
$mkdir project_name
$cd project_name
$python3 -m venv env
$cd project_name
$python3 -m venv env
On windows:
$py -3 -m venv env
So, we should activate our virtual environment.
$source env/bin/activate
That's it our configure. We already begin to write some code.
So, you can use your favorite code editor. In my case, I want to use Vim. :D
First, we should create a new python script file. Just save it as First.py or something similar.
Here's my First.py:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def about():
return 'Hello world!, this is my first blog'
if __name__ == '__main__':
app.run(debug=True)
After, open your terminal or cmd. Then, write this command.app = Flask(__name__)
@app.route('/')
def about():
return 'Hello world!, this is my first blog'
if __name__ == '__main__':
app.run(debug=True)
$python First.py
By default, Flask runs on localhost:5000That's it my first tutorial. See you guys. Enjoy :D :)
Comments
Post a Comment