As an experienced website operations expert, I fully understand the importance of setting up a local development environment.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 into how to easily set up and test the AnQiCMS running on the Windows system, and embark on your local development and debugging journey.
Easily set up AnQiCMS local development and debugging environment on Windows system
AnQiCMS as an enterprise-level content management system developed based on the Go language, with its high efficiency, security, and ease of use, has been favored by many small and medium-sized enterprises and content operators.In order to fully tap its potential and ensure that every launch is flawless, it is essential to set up a local development and debugging environment.This allows you to freely explore the various functions 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?
Local development environment is like your exclusive 'sandbox', with multiple advantages:
- Safe and worry-freeAll changes are made locally and will not affect the online website. Even if errors occur, they can be easily traced back, allowing you to try boldly without worrying about the stability of the production environment.
- Quick iterationModify code or content locally, which can usually see the effect immediately, greatly shortening the development cycle and improving work efficiency.
- Deep learning and customization:You can gain a deeper understanding of 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 the foundation for future advanced customization.
Now, let's step by step to build the local development environment of AnQiCMS.
Preparation: Overview of required tools
Before you begin, please make sure that your Windows system version is Windows 10 or higher, and be prepared with the following “equipment”:
- AnQiCMS Windows installation packageThis is our locally running core program.You can download the latest version from the official website of AnQiCMS, please make sure to select the compressed package released for the Windows platform.
- MySQL databaseAnQiCMS needs a database to store all content, user data, and system configurations.Although AnQiCMS itself is developed in Go language, its data storage relies on MySQL.
- Simple recommendationFor most non-professional database administrators, installing integrated environments likeXAMPPorEnglish Serveris 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.
Whichever method you choose, make sure your MySQL service is running and that you know its
rootThe password of the user (or the account password of any 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 to download the latest Windows version installer. After downloading, find a directory you like (for example,C:\anqicms-dev),will extract the downloaded compressed package to this directory. After extraction, you will seeanqicms.exeexecutable files as well astemplate/publicfolders such as.
Step 2: Run AnQiCMS for the first time and complete the initialization.
Now, it's time to get AnQiCMS moving.
- Start AnQiCMS: Go to 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 preferred web browser, enter in the address bar
http://127.0.0.1:8001and press Enter.- If everything goes well, you will see AnQiCMS'sInitialization installation interface.
- In this interface, you need to enter your MySQL database information (including the database address, port, username and password), and set up an administrator account and password for your AnQiCMS backend.Please make sure to remember this information.
- complete the installation according to the prompts.
- verify the installation:Installation successful after, the system will usually automatically jump to the front page of the website. You can try to access
http://127.0.0.1:8001/system/Enter the backend management interface, log in with the administrator account and password you just set.If both the front-end and back-end can access and operate normally, congratulations, the AnQiCMS local development environment has been successfully set up!
Third step: Local development and debugging
Environment setup is complete, now you can start your content creation and feature customization.
- Modify template filesThe template files of AnQiCMS are located in the directory where you have extracted.
templateFiles. It uses a template engine syntax similar to Django, through{{变量}}Output data,{% 标签 %}Control logic.You can directly modify the HTML file, CSS style, or JavaScript script in this folder.template/default/index/index.html(Assuming you are usingdefaulttemplate).- take effect immediatelyMost of the time, changes you make to the template file will be reflected in the browser immediately, without the need to restart
anqicms.exeThis greatly speeds up the debugging efficiency. - Clear cacheIf some modifications are not effective 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.
- take effect immediatelyMost of the time, changes you make to the template file will be reflected in the browser immediately, without the need to restart
- Front-end debuggingFor web front-end style, layout, and interaction issues, 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 logsAlthough
anqicms.exeIt is non-interactive, but during execution, it may output important log information to the command line window or to the specified file. If you encounter backend errors during execution, please check the log files in the AnQiCMS runtime directory (for examplerunning.logDespite the official documentation,start.shThe script mentions that this file is mainly used for Linux, but the Windows version may directly output to the console or to other default log files, or may be started via command lineanqicms.exeCheck to view the real-time output.
Advanced: Multi-site local development and pseudo-static 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 still feasible:
- Modify the portEach AnQiCMS instance requires an independent port. You can copy the AnQiCMS installation directory and then modify the directory under the new one.
config.jsonfile, and change the one in theportParameter is changed 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 Windows'hostsFile (locatedC:\Windows\System32\drivers\etc\hosts), add the following entries:
Then, you can access different local sites by127.0.0.1 yoursite1.local 127.0.0.1 yoursite2.localhttp://yoursite1.local:8001andhttp://yoursite2.local:8002. - Reverse proxy (recommended Baota/PHPStudy)If you want to access through the standard 80 port or 443 port (no port number or HTTPS),