Start from the installation of Python's various systems to teach you the actual case! Getting started with Python is simple!

Source: Internet
Author: User

-How to install Python

-How to install and use Pip

-Pycharm Local How to configure

-Pycharm How to configure the remote debugging environment

-How to set up a Web site with Python as the backend core on the server

1 Installing Python

The first step, of course, is to install Python.

Enter the group: 125240963 can get dozens of sets of PDFs Oh! Private Messages 01 can get a variety of installation tools and installation packages!

1.2 Ubuntu System

The Ubuntu system uses the default package management tool apt. Use the following command to install Python:

Then enter PIP3, if there is a normal return, then done!

1.3 Python2/3 Easy Separation

Sometimes we just want to use Python3, but Python2 will interfere, so how to solve it? Quite simply, instead of entering Python when you want to use Python3, enter Python3, instead of entering a PIP when using the Python3 pip instead of entering PIP3. For example, to install Flask for Python3:

2.1 Creating a new project

Let's create a new project.

Then we find the location of Python and add it. How do I find a Python location? See the first section.

2.2 Changing the environment of an existing project

What if the configuration was wrong at first? Click Pycharm > Preference > Project > Project interpreter settings.

This method is an easy way to install one or two packages. So what if it's a lot of packages? We are going to use PIP at this time.

In general, the standard Python source code in GitHub provides a document called Requirements.txt, which records the name and version of the package to be installed.

Then we open the Terminal window in Pycharm:

3.1 Configuring remote connections

First, suppose we have a server on hand and a server account and password.

Then open Tools > Deployment > Configuration > New

    • Local path: A native address mapped to the corresponding location on the server
    • Deploy Path: The folder location on the server. Root path + Deploy path is the full path where our files are located on the server.

After the configuration is complete, click Tools > Browse remote Host and the file on the right side of our server indicates that the remote connection was successful!

4 Python WEB Environment setup

This is the highlight of this article-how to build a Web site on a server with Python. It is recommended Python-flask + Nginx + gunicorn +supervisor + Sqlite scheme, because these software are very friendly to the novice. Where Python-flask is the backend core, Nginx is the front-end server, Gunicorn is the back-end server, Supervisor is the process monitoring software, Sqlite is a lightweight database.

If the display ' Running on http://127.0.0.1:5000 indicates that the frame is functioning properly.

4.2 Installing Nginx, Gunicorn and Supervisor

Run on the server:

4.4 Configuring Supervisor

Generate the supervisor.conf file in your favorite directory:

    1. echo_supervisord_conf > supervisor.conf
    2. # Generate Supervisor Default profile

To open a configuration file:

    1. Nano supervisor.conf

At the bottom add:

4.7 Supervisor's Small bug

Sometimes, because of server restart and other reasons supervisor will appear an error:

Learn it!

Start from the installation of Python's various systems to teach you the actual case! Getting started with Python is simple!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.