Python+Wordpress makes novels
- 2020-05-27 06:30:56
I built a fiction station using Python and Wordpress.
The following section focuses on the techniques used in the build process. It is mainly divided into the following parts:Wordpress theme selection The perfection of the novel content Deployment of the site The construction of WeChat public platform
1. Selection of Wordpress theme
Because I am not very familiar with writing php code, writing websites directly is likely to encounter various security vulnerabilities. Compared with the current popular blog frameworks wordpress, joomla and drupal, wordpress has a wide audience. After that, I selected a set of novel templates and mounted the horse like this ~~
2. Perfection of the novel content
2.1 data capture
As a novel station, the most important is the content of the novel. In the traditional market, there are various shortcomings in the popular novel collection plug-in. With its own expertise in data capture, it adopts directional capture for several novel sites. Subdivided a number of 10 fields, MongoDB database storage, and achieve weight, to prevent repeated fetching.
2.2 content upload
Due to the adoption of wordpress framework, content upload naturally requires the classic wordpress library file -- wordpress_xmlrpc, which adopts wordpress_xmlrpc to upload the content and tags of novels and articles. However, there are limitations to the library. For the article classification of the various categories of input is not chicken. Therefore, I simulated wordpress and automatically sorted the fields of the post directory. At the same time, the input of novel information into post is huge, and too many fields of post are simply used to simulate the login of post. Finally, relevant data is directly inserted from MySQL database to realize the update. In summary, there are three ways to update:wordpress_xmlrpc module upload python simulates background login and active upload Directly update MySQL database related content to achieve front-end update
3. Site deployment
The site USES the CentOS server of aliyun. For those who are not familiar with the Linux system, I use the wdcp control panel to realize the deployment of wordpress site. This paragraph is unnecessary.
4. Build WeChat public platform
WeChat public platform adopts Linux server +Flask+MySQL deployment, temporarily only realize the input of keywords to search the database of the novel name, text and text return the name and link of the novel, WeChat to read novels anytime and anywhere.
For the specific methods and steps of building WeChat public platform with Python, please refer to the previous column: developing WeChat public platform with Python.
In this way, the implementation of the novel site. In fact, the above method is not limited to the construction of such sites, such as taobao customer site construction, entertainment site construction and so on are applicable, then rely on you to dig ~
This novel site is a small project of my practice, now it is mainly for my personal use. If there is any infringement problem, please contact me in time, and I will delete relevant content in time.