Content management system Wagtail CMS based on Python Django local deployment and remote access [intranet penetration]

Preface

This article introduces how to install and run Wagtail, and combine it with the cpolar intranet penetration tool to achieve remote access to the management interface on the public network.

Wagtail is an open source CMS written in Python and built on the Django web framework. Wagtailis an Djangoopen source content management system based on , with strong community and commercial support. It focuses on user experience and provides designers and developers with precise control.

Reasons for choosing wagtail:

  • It can quickly realize the expression of the page. For students like me who want to find a place to display the newly implemented functions, but are not very good at front-end capabilities.
  • Based on django, stable versions of django will always be supported.

Wagtail is built by developers for developers. Then combined with cpolar intranet penetration, you can perform remote access to the public network, spending less time on configuration and more time on improving your website.

Wagtail: an open source CMS content management system based on Python Django for local deployment and remote access

1. Install and run Wagtail

Wagtail supports Python 3.8, 3.9, 3.10 and 3.11.

To check if you have the appropriate Python 3 version, run the following command:

python --version
# Or:
python3 --version
# **On Windows** (cmd.exe, with the Python Launcher for Windows):
py --version

If none of the above commands returns a version number, or returns a version lower than 3.8, install Python 3 .

1.1 Create and activate virtual environment

Install in order

pip install wagtail
wagtail start mysite
cd mysite
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

972e759204e102f0f02d72f3f9debce

After the installation is complete and the server is started, visit http://127.0.0.1:8000/ to see the Wagtail welcome page.

f6c9c2ba0e7fceb1cd3fee6530cd32c

2. Install cpolar intranet penetration tool

The above has successfully installed Wagtail locally and successfully accessed the LAN. Next, we install the Cpolar intranet penetration tool and forward the http public network address mapped to the local port through cpolar. We can easily achieve remote access without having to register a domain name ourselves and purchase a cloud. Server. The following are the steps to install cpolar

cpolar official website address: https://www.cpolar.com

  • Use one-click script installation command
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
  • Add services to the system
sudo systemctl enable cpolar
  • Start cpolar service
sudo systemctl start cpolar

After cpolar is successfully installed, access Linux port 9200 on an external browser: [http://LAN ip:9200]. Log in using your cpolar account. After logging in, you can see the cpolar web configuration interface, which is connected to the web management interface. Just configure

image-20230831171159175

3. Implement Wagtail public network access

Click Tunnel Management - Create Tunnel on the left dashboard to create a Wagtail cpolar public network address tunnel.

  • Tunnel name: You can customize the name. Be careful not to duplicate the existing tunnel name.
  • Protocol: Select http
  • Local address: 8000 (port for LAN access)
  • Domain name type: Choose a random domain name for free
  • Region: Select China

Click创建

image-20231117142958650

After the tunnel is successfully created, click 状态- on the left 在线隧道列表to view the generated public network access address. There are two access methods, one is http and https

image-20231117143052181

Use the cpolar https public address above to access the browser on any device, and you can successfully see Wagtail's welcome interface. In this way, a public address that can be accessed remotely has been created. There is no need to purchase a cloud server yourself, and it can be published to Public network access.

image-20231117152345900

4. Fixed Wagtail public network address

Since the tunnel created using cpolar above uses a random public network address, it will change randomly within 24 hours, which is not conducive to long-term remote access.

I usually use a fixed second-level subdomain name because I want to send the URL to the public network. Others can access this fixed URL for a long time without having to re-create the tunnel every time. It is a fixed and easy-to-remember public network address (for example, : wagtail.cpolar.cn), which makes it more formal and facilitates communication and collaboration. Therefore, we can configure a second-level subdomain name for it. This address is a fixed address and will not change randomly [ps: cpolar.cn has been filed]

Note that you need to upgrade the cpolar package to a basic package or above, and the bandwidth corresponding to each package is different. [cpolar.cn has been registered]

Log in to the cpolar official website , click Reserve on the left, select to reserve the second-level subdomain name, set a second-level subdomain name, click Reserve, and copy the reserved second-level subdomain name after the reservation is successful.

image-20231117152931752

After the reservation is successful, copy the name of the second-level subdomain name that was successfully reserved.

image-20231117152958088

Return to the cpolar web UI management interface, click Tunnel Management - Tunnel List on the left dashboard, find the tunnel you want to configure, and click Edit on the right

image-20231117153047768

Modify the tunnel information and configure the successfully reserved second-level subdomain name into the tunnel.

  • Domain name type: Select a second-level subdomain name
  • Sub Domain: Fill in the successfully reserved second-level subdomain name

Click 更新(note, click once to update, no need to submit again)

image-20231117153301193

After the update is completed, open the online tunnel list. At this time, you can see that the public network address has changed and the address name has become a fixed second-level subdomain name.

image-20231117153602521

Finally, we use a fixed public network address to access, and we can see that the access is successful. In this way, a fixed and permanent public network address is set.

image-20231117153652283

Guess you like

Origin blog.csdn.net/xianyun_0355/article/details/135136209