Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to test HelloGitHub

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to test HelloGitHub". In daily operation, I believe many people have doubts about how to test HelloGitHub. Xiaobian consulted various materials and sorted out simple and easy operation methods. I hope to help you answer the doubts about "how to test HelloGitHub"! Next, please follow the small series to learn together!

1. Simple test

HelloGitHub: "Hey, don't worry, let's run it on the local platform first, test the test function, understand the basic use of this project, and then move forward step by step. "

In just 6 steps you can get this project up and running from scratch!

1. Our local experimental environment is:

Windows 10 64-bit operating system

Python 3.7,pip 21.0.1

2. We need to clone the open source project locally, using the following command:

git clone https://github.com/zmister2016/MrDoc

3. Install the required third-party library for MrDoc: enter the Mrdoc/directory and run the following command:

4. Initialize the database. SQLite database is used by default for this project. Execute at the command line:

Create an administrator account to manage the entire MrDoc app. Note that user names and email addresses are unique throughout the MrDoc app.

6. Local online testing: In a testing environment, you can run MrDoc using Django's own server.

II. Edible instructions

Xiaobai rubbed his hands and looked forward to: "I also succeeded in the local test. Can I explore the eggs inside?" "

HelloGitHub: "Okay, so the key keywords for the project are: personal team collaboration and document management. Let me show you MrDoc in its entirety. "

2.1 register and log in

HelloGitHub: "When we visit the site, we do it as visitors. If we need to register an ordinary user account, you need to fill in the corresponding form information, after registration will automatically jump to the login interface. "

Xiaobai: "Supplement: In fact, if visitors want to click New → New Document, they also need to log in. "

2.2 Collection Documents

HelloGitHub: "When we log in, we can create a collection in New → New Collection. "

Xiaobai: "I found that you can click on the anthology on the home page to enter the browsing and reading page of the anthology. You can also add a new document." On the document editor page, we can click on the document tree to select the parent of the current document or cancel the parent, and sort different documents by entering the document sort value. "

HelloGitHub: "Well, now we don't have to worry about the tutorial learning articles being disconnected, because they're all distributed hierarchically in our collection. However, because MrDoc currently supports up to level 3 documents, don't let your document tree become too big. "

HelloGitHub: "One of the really important things is team sharing and collaboration. We ordinary users can manage their own collections, click Personal Center → My Collections → Collection Management → Collaboration Management icon at Collection Members, you can add collaborators. And in Collection Management → Operation → Collection Settings small icon can modify basic information, permission configuration and management control. When the permission is set to public, the collection can be seen when visiting the web page as a guest; when the permission is set to private, only you can see it. Of course, it can also be seen by fixed people, which can also realize the sharing of small teams. "

2.3 document editing

HelloGitHub: "Now we're looking at MrDoc's document editing and modification module, which supports both Markdown and rich text for document writing, giving us three editors to use. It can support the insertion of mathematical formulas, flowcharts, sequence diagrams, brain diagrams, Echarts graphs and timelines, add audio and video links and picture attachments, etc., and create document templates. In short, the summary is endless, and the diagram is endless. It needs to be slowly skilled in the use process. "

Xiaobai: "I can understand it now. In Personal Center → My Documents → Document Management, all documents created can be managed uniformly, and historical version management information can also be seen, which is convenient for users to compare and facilitate team collaboration management." "

2.4 admin [Admin]

HelloGitHub: "Big boss permissions must be very high, everything is collected, including user collections, documents, document modules, but also user management and site settings. "

Little White: "Then I will be my own master." "

III. On-line deployment

HelloGitHub: "I have already understood some functions, but will it be too much to run locally? Do you have to consider deploying this project to our Cloud Virtual Machine to enable your small team to achieve high-level knowledge collaboration management?" "

Xiaobai: "You can have an extra fishing tool with your friends in the group. It's very happy to think about it ~"

HelloGitHub: "Well, deploy first, who knows how many holes will appear in the process. In order to proceed smoothly, our method this time will use the more complete tutorial provided by the official: deploying MrDoc using Nginx + uWSGI. "

1. Our cloud hosting environment is:

Ubuntu 18.04.4 LTS

Python 3.6.9,pip 21.0.1

In the ~ directory, that is, use the pwd command to view it as: /home/purple, and change your friends to their corresponding directories.

2. Install uWSGI and Nginx:

sudo apt-get install uwsgisudo apt install uwsgi-plugin-python3sudo apt-get install nginx

3. Pull the source code of MrDoc locally (with the previous command), but in order not to affect the existing environment on the server, we need to use the virtual environment this time:

4. Enter the MrDoc folder and repeat steps 3, 4 and 5 of the simple test to install the dependency library, initialize the database and create an administrator account (omitted).

5. We create a new folder named mrdoc_deploy under the ~ directory. The command is as follows, which is used to store the relevant files for deployment.

mkdir /home/purple/mrdoc_deploy

(1)uWSGI Profile:

Create a new file named uwsgi_params in the mrdoc_deploy directory and write it with vim uwsgi_params command:

uwsgi_param QUERY_STRING $query_string;uwsgi_param REQUEST_METHOD $request_method;uwsgi_param CONTENT_TYPE $content_type;uwsgi_param CONTENT_LENGTH $content_length;uwsgi_param REQUEST_URI $request_uri;uwsgi_param PATH_INFO $document_uri;uwsgi_param DOCUMENT_ROOT $document_root;uwsgi_param SERVER_PROTOCOL $server_protocol;uwsgi_param REQUEST_SCHEME $scheme;uwsgi_param HTTPS $https if_not_empty;uwsgi_param REMOTE_ADDR $remote_addr;uwsgi_param REMOTE_PORT $remote_port;uwsgi_param SERVER_PORT $server_port;uwsgi_param SERVER_NAME $server_name;

Create a new file named mrdoc_uwsgi.ini under the mrdoc_deploy directory, and write it with vim mrdoc_uwsgi.ini in the same way:

[uwsgi]# Django-related settingssocket = :8008# the base directory (full path)chdir = /home/purple/MrDocvirtualenv = /home/purple/mrdoc_env# Django s wsgi filemodule = MrDoc.wsgi:applicationwsgi-file = MrDoc/wsgi.py# process-related settings# mastermaster = true# maximum number of worker processesprocesses = 1threads = 2# ... with appropriate permissions - may be needed# chmod-socket = 664# clear environment on exitplugins = python3vacuum = truepython-autoreload = 1# buffer sizebuffer-size = 65536

Note: If the following problems occur during subsequent service runs, you need to adjust the buffer-size parameter under mrdoc_uwsgi.ini.

spawned uWSGI master process (pid: 21172)spawned uWSGI worker 1 (pid: 21173, cores: 2)invalid request block size: 21573 (max 4096)... skipinvalid request block size: 21573 (max 4096)... skip

(2)Nginx configuration file

Create a new file named mrdoc_nginx.conf in the mrdoc_deploy directory and write the following with the command vim mrdoc_nginx.conf:

server { listen 80; server_name Enter domain name here; charset UTF-8; access_log /var/log/nginx/mrdoc_access.log; error_log /var/log/nginx/mrdoc_error.log; client_max_body_size 75M; location / { include /home/purple/mrdoc_deploy/uwsgi_params; uwsgi_pass 127.0.0.1:8008; uwsgi_read_timeout 60; } location /static { expires 30d; autoindex on; add_header Cache-Control private; alias /home/purple/MrDoc/static; } location /media { alias /home/purple/MrDoc/media; }}

Note that in the server_name parameter, you need to fill in your own domain name. Here I fill in the public IP address of the cloud host, and then you need to enter this IP address to access the website.

(3)In order for the MrDoc application to function as we wanted, we used systemctl to manage the service.

Create a new file named mrdoc.service under the mrdoc_deploy directory, and write the following contents to the file with the command vim mrdoc.service:

[Unit]Description = MrdocAppAfter = syslog.target[Install]WantedBy = multi-user.target[Service]WorkingDirectory = /home/purple/MrDocExecStart = /usr/bin/uwsgi --ini /home/purple/mrdoc_deploy/mrdoc_uwsgi.iniUser = purpleRestart = alwaysStandardError = syslog~

6. Add process management

sudo systemctl enable /home/zmister/mrdoc_deploy/mrdoc.service

7, Create Nginx site soft link

sudo ln -s /home/zmister/mrdoc_deploy/mrdoc_nginx.conf /etc/nginx/sites-enabled/mrdoc_nginx.conf

8. Start MrDoc service

sudo systemctl start mrdoc.service

Note: When trying to start, the following error occurs. The reason is that when configuring mrdoc.service, the ExecStart parameter is written as uwsgi according to the official documentation, but in fact it should be written as an absolute path (you can check your own path). Mine is/usr/bin/uwsgi.

(mrdoc_env) purple@VM-Purplezi-Ubuntu ~ % sudo systemctl start mrdoc.serviceFailed to start mrdoc.service: Unit mrdoc.service is not loaded properly: Exec format error.See system logs and 'systemctl status mrdoc.service' for details. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report