This is the 7th day of my participation in the November Gwen Challenge. Check out the details: The last Gwen Challenge 2021

Previously on

In the last article, I gave you a very detailed introduction to the basic configuration of cloud server and how to use it, and introduced some common Linux instructions. Finally, I took you to deploy a project on the server.

However, because xx cloud server presented query project source can not directly to you, so this article will take you to use Python to quickly build a Web project: resume.

Note: this article does not involve cloud server introduction, Linux instructions introduction, project deployment to the server and other related content, do not know these please see me write cloud server first article: Pilot * with old table learn cloud server – after having a server, I unexpectedly so cool? .

Second, basic preparation

If you want to deploy this project to the server, you must first look at: Pilot * With old table learn cloud server – have a server, I unexpectedly so cool? .

Server environment:

  • Basic environment: Python 3.6 and above is acceptable
  • Third Party library:

Pipenv: Virtual environment management library PyWeBio: Web Project framework

Three, start using your head

3.0 Project Presentation

3.1 Project Roadmap

There is only one page this time, that is, the resume display page, which can be interpreted as a blog, static file, etc. In essence, we still use MD to write the same as the first article. Why DO I like Markdown so much?

  • Faster custom content formats
  • The syntax is simple, and if you write a lot, you’ll feel like they’re one
  • More portability, as long as you copy your content back where Markdown is supported, the format will never change (unless you set CSS styles yourself)

The PyweBio module provides the function put_markDown to render markDown statements, but it does not provide the function to render markdown files directly. A resume MD template is 72 lines long.

So what I did was read the local MD file as a string and pass it into put_Markdown for rendering, so the code looks more maintainable and beautiful.

The backend framework takes advantage of the benefits of PyWeBio. We only need to write the back-end code, and the framework will render the front end display page for us, allowing writers to quickly build Web projects. It’s not too nice

3.2 Find a Markdown resume template

This is actually quite simple. Just do a browser search and the first thing you’ll find is a GitHub project.

After opening, I found that it is very consistent with my expectations, so, let’s start ~

Git related operations.

3.3 Code details

The whole project was only 10 lines long, and we were able to render a nice resume page. It smelled good.

1) PyWeBio is only used for output, so it only needs to import related functions in Pywebio. In addition, session (modify related Settings for rendering) and start_server (start service) are imported.

from pywebio import session, start_server
from pywebio.output import put_markdown
Copy the code

My_resume = my_resume = my_resume

  • Line 1: Declare a function my_resume. In PyWeBio, just defining a function creates a page.
  • Line 2: Call session.set_env to customize the page title and cancel the output transition animation;
  • Line 3-4: Read the md content and store it in the md_txt variable;
  • Line 5-6: Call put_markdown to render the MD content.
def my_resume() :
    session.set_env(title='My old cousin's resume', output_animation=False)
    with open('resumeblog/Resume.md') as md:
        md_txt = md.read()
    put_markdown(md_txt)
    put_markdown(

Wish you success in your job search and remember to learn cloud server with my old cousin! '
) Copy the code

3) Start the service 2 lines of code, as the main entrance of the program, start the service.

  • Line 1: Checks if it is the main entry (executed from the py file), if it is, executes the if content, if it is not. The advantage is that when tests are called to each other in multiple files, the code is not executed repeatedly;
  • Line 2: Call the start_server function to start the service, passing three arguments, the first being the page function name; The second is which port the server is started on; The third is whether the browser automatically opens to access the page after the program runs.
if __name__ == '__main__':
    start_server(my_resume, port=8081, auto_open_webbrowser=True)
Copy the code

3.4 Extra meal: Git related operations

Go to the Github project page at github.com/new, enter the project name and other relevant information, and click Create Repository.

After the project is successfully created, obtain the clone address of the project, there are many modes, generally choose HTTPS or SSH, the later local project upload will be used.

Before you proceed with the following steps, you need to make sure that you have Git installed. If you do not have Git installed, you can download it from the official website.

In the local project directory, open the terminal and make sure it is in the project directory. For example, in the screenshot, I typed git init in the terminal and initialized the project so that the system could recognize it as a Git repository.

Then type git add. Add all the files in the file to the cache and commit with git commit.

However, before git push, you need to tell Git which repository to push the project to, by executing Git remote Add Origin.

Git remote add Origin [email protected]: your username/repository nameCopy the code

Git push is the last step.

git push -u origin master
Copy the code

Git push origin +master

Go back to Github and refresh the project page to see that the files have been uploaded

Iv. Notice of the next period

If you don’t know anything about servers and Linux, this article is recommended

Later, I will officially start the system’s cloud server learning tutorial update (should not be systematic, is where I think, where I feel necessary, can talk about, I will share, and so on the whole series of updates should be very systematic)

This process also hope that we can give more support, feedback, encourage each other ~

This article all related source, you can directly go to Github download, the project source address: github.com/XksA-me/Res…

See you next time. I’m a cat lover and a tech lover. If you find this article helpful, please like, comment and follow me!