☁️Deployment of Python Flask Website Project on Huawei Cloud ECS Service

ibrahim samed
Huawei Developers
Published in
3 min readJul 5, 2024
Flask

Introduction

Hello Everyone!

Today, we will create the website with Flask and run this project on our ECS service.

What is ECS?

An Elastic Cloud Server (ECS) is a basic computing unit that consists of vCPUs, memory, OS, and Elastic Volume Service (EVS) disks.

You can create an ECS by specifying its vCPUs, memory, OS, and login mode. After creating an ECS, you can use it on the cloud like using your local PC or physical server. You can also modify its specifications if necessary. ECS lets your applications run in a reliable, secure, efficient computing environment.

What is Flask?

Flask is a web framework, it’s a Python module that lets you develop web applications easily. It’s has a small and easy-to-extend core: it’s a microframework that doesn’t include an ORM (Object Relational Manager) or such features.

It does have many cool features like url routing, template engine. It is a WSGI web app framework.

Create ECS

Before create ECS We need VPC and security Group with 80 and 5000 port. After that, we buy ECS like image shown below.

purchase ECS page 1

We made the adjustments shown in the image. You can follow these steps for ECS installation.

purchase ECS page 2

Next configurations

purchase ECS page 3

Keep Going like images.

purchase ECS page 4

Finally, submitted ECS.

submit ECS purchase

Login ECS

After purchase ECS, ECS must shown as below. You can see login button and EIP address on ECS list. Do remote login.

ECS List

The image shows ECS virtual machine and commend input page.

login : root 
password: your_password

Now you are in your machine, we can start setup our project.

git clone <repo-url> /// get your project
//you can access my sample repo
https://github.com/ibrahimsamed/Flask-Web-App-Tutorial.git
VM login page

We will run main.py file and main file must include copy commands are for access with EIP. I will change main file if command line with on right code.

main.py file

We need our project library and tools (requirements), and install all of them automatically

pip install -r requirements.txt

Run python code,

python main.py

After run code we control on own browser, as you see I accessed my flask website page with ECS EIP address from 5000 port

website

References

--

--