As an experienced website operations expert, I fully understand the importance of setting up a development environment locally.It not only allows you to safely test new features and adjust page layouts, but also accelerates content creation and feature iteration without affecting the online website.Today, let's delve deeply into how to easily set up and test run AnQiCMS on the Windows system, starting your local development and debugging journey.
Easily set up the AnQiCMS local development and debugging environment on Windows
AnQiCMS is an enterprise-level content management system developed based on the Go language, known for its efficiency, security, and ease of use, it has been favored by many small and medium-sized enterprises and content operators.To fully utilize its potential and ensure that each online launch is flawless, it is essential to set up a local development and debugging environment.This allows you to freely explore all the features of AnQiCMS on your own computer, whether it's customizing content models, adjusting template styles, or testing SEO optimization strategies, you can do it with ease.
Why choose local development and debugging?
The local development environment is like your exclusive sandbox, with multiple advantages:
- Safe and worry-freeAll changes are made locally, which will not affect the online website. Even if there are errors, they can be easily traced back, allowing you to try boldly without worrying about the stability of the production environment.
- Rapid iterationModifying code or content locally usually produces immediate results, greatly shortening the development cycle and improving work efficiency.
- Deep learning and customization: You can better understand the operation mechanism of AnQiCMS, whether it is through modifying template files to understand its Django-style template syntax, or testing the pseudo-static rules, you can get intuitive feedback, laying a foundation for future advanced customization.
Now, let's build the local development environment for AnQiCMS step by step.
Preparation: list of required tools.
Before you begin formally, please ensure that your Windows system version is Windows 10 or higher, and prepare the following equipment:
- AnQiCMS Windows installation packageThis is the core program running locally. You can download the latest version from the AnQiCMS official website, please make sure to choose the compressed package released for the Windows platform.
- MySQL database: AnQiCMS needs a database to store all content, user data, and system configuration.Although AnQiCMS itself is developed in Go language, its data storage depends on MySQL.
- Simple recommendationFor most non-professional database administrators, installing integrated environments such asXAMPPorWAMP ServerIt is the most convenient way. They integrate Apache/Nginx, MySQL, and PHP, and can be installed with one click to have a fully functional local server environment, which includes the MySQL we need.
- Professional Recommendation: If you are familiar with Docker, you can also consider usingDocker DesktopDeploy a MySQL container to better isolate the environment. No matter which method you choose, make sure your MySQL service is running and you know its
rootThe password of the user (or the account password of another user with database creation permissions), which will be used for the initialization installation of AnQiCMS.
First step: Download and unzip the AnQiCMS installation package
First, please visit the AnQiCMS official website, download the latest Windows version installation package. After downloading, find a directory you like (such asC:\anqicms-dev), extract the downloaded compressed package to this directory. After extraction, you will seeanqicms.exeexecutable files andtemplate/publicand other folders.
Second step: run AnQiCMS for the first time and complete the initialization
Now, it's time to get AnQiCMS moving.
- Start AnQiCMS: Go into the AnQiCMS folder you just unzipped, find
anqicms.exefile, thendouble-click to runIt. This is a background-running program, you may not see any interface pop up, but it has quietly started in the background. - Browser access: Open your commonly used web browser, enter in the address bar
http://127.0.0.1:8001and press Enter.- If everything goes well, you will see the AnQiCMSinitial installation interface.
- In this interface, you need to enter your MySQL database information (including database address, port, username, and password), and set up an administrator account and password for your AnQiCMS backend.Make sure to remember this information.
- complete the installation according to the prompts.
- Verify InstallationAfter the installation is successful, the system will usually automatically jump to the front page of the website. You can try to visit
http://127.0.0.1:8001/system/Log in to the backend management interface using the administrator account and password you just set up.If both the front-end and back-end can access and operate normally, congratulations, the AnQiCMS local development environment has been successfully set up!
Step 3: Local Development and Debugging
The environment setup is complete, now you can start your content creation and function customization.
- Modify the template fileThe AnQiCMS template files are located in the directory where you extracted them.
templateIn the folder. It uses a template engine syntax similar to Django, through{{变量}}to output data,{% 标签 %}Control the logic. You can directly modify the HTML files, CSS styles, or JavaScript scripts in this folder.For example, if you want to change the layout of the website homepage, you can try to modifytemplate/default/index/index.html(Assuming you are usingdefaulttemplate).- Immediate effect.In most cases, your modifications to the template file will be reflected in the browser immediately without needing to restart
anqicms.exeThis greatly speeds up the debugging efficiency - Clear cacheIf sometimes the modification does not take effect in time, you can log in to the AnQiCMS background, click the "Update Cache" option in the left menu, and clear the system cache.At the same time, it is also recommended that you clear the browser cache to ensure that the latest files are loaded.
- Immediate effect.In most cases, your modifications to the template file will be reflected in the browser immediately without needing to restart
- Front-end debugging: For front-end style, layout, and interaction issues of web pages, you can use the built-in developer tools of the browser (usually opened by pressing F12) to check.They provide powerful features such as element inspection, style debugging, and JavaScript console.
- Backend logging: Although
anqicms.exeIt is non-interactive, but during operation, it may output important log information to the command line window or to a specified file. If an backend error occurs during operation, please check the log files in the AnQiCMS running directory (for examplerunning.logDespite the official documentation statesstart.shThe script mentions that this file is mainly used for Linux, but the Windows version may directly output to the console or have other default log files), or start through the command lineanqicms.exeCheck the real-time output.
Advanced: Multi-site Local Development and URL Rewriting Configuration
If you have multiple websites that need to be developed and debugged locally, or you need to test pseudo-static rules, the operation will be a bit more complex, but it is still feasible:
- Modify portEach AnQiCMS instance requires an independent port. You can copy the AnQiCMS installation directory, then modify the directory under the new directory.
config.jsonFile, containing theportChange the parameter to a new unused port number (for example8002) - Configuration
hostsFile: In order for your browser to access these local sites through a custom domain, you need to modify the WindowshostsFile locatedC:\Windows\System32\drivers\etc\hosts), add the following entries:
Then, you can access127.0.0.1 yoursite1.local 127.0.0.1 yoursite2.localhttp://yoursite1.local:8001andhttp://yoursite2.local:8002different local sites. - Reverse proxy (recommended Baota/PHPStudy)If you wish to access through standard ports 80 or 443 (without port number or HTTPS),