diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..01467a3dd0a84405d93d49f959bace1e2d906150 --- /dev/null +++ b/README.en.md @@ -0,0 +1,91 @@ +This project is a multi-module composite project that includes multiple functional modules such as Flask Web development, web scraping (crawling), and data visualization. Below is a brief description of the project: + +--- + +## Project Structure Overview + +### Flask Module +- **1_flask.py**: Main program for the Flask Web application, containing the following routes: + - `/`: Access the root path, invokes the `hello()` method. + - `/index`: Access the `/index` path, invokes the `index()` method. + - `/get/`: Dynamic route that accepts the `name` parameter and returns the corresponding value. +- **templates/index.html**: Flask template file used to render web content. + +### Data Visualization Module (pyecharts) +- **bar1.py, line1.py, quickstart.py**: Example code for generating charts using pyecharts. +- **bar1.html, line1.html, result.html**: Generated HTML chart files used to display bar charts, line charts, and other visualized data. + +### Web Scraping Module (Scrapy) +- **game/spiders/a4399game.py**: Scrapy spider module used to scrape data from the 4399 game website. +- **game/items.py**: Defines the structure (Item) of the scraped data. +- **game/pipelines.py**: Data processing pipelines, including default and custom pipeline classes. +- **game/middlewares.py**: Middleware used to handle requests and responses. +- **game/settings.py**: Configuration file for the Scrapy project. +- **scrapy.cfg**: Scrapy configuration file used for deploying and running the spider. + +### Other Files +- **.idea/**: IDE configuration files (e.g., for PyCharm). +- **GUI/**: Contains GUI-related image resources (e.g., `gui.png` and `my.gif`). + +--- + +## Usage Instructions + +### Flask Web Application +1. Install Flask: + ```bash + pip install flask + ``` +2. Run `1_flask.py`: + ```bash + python Flask/1_flask.py + ``` +3. Access the following URLs: + - `http://127.0.0.1:5000/`: Displays the Hello page. + - `http://127.0.0.1:5000/index`: Displays the Index page. + - `http://127.0.0.1:5000/get/`: Dynamically displays the passed parameter. + +### Data Visualization (pyecharts) +1. Install pyecharts: + ```bash + pip install pyecharts + ``` +2. Run the example code (e.g., `bar1.py`): + ```bash + python pyecharts/bar1.py + ``` +3. Open the generated HTML file (e.g., `bar1.html`) to view the chart. + +### Scrapy Web Scraper +1. Install Scrapy: + ```bash + pip install scrapy + ``` +2. Run the spider: + ```bash + cd scrapy/01scrapy + scrapy crawl a4399game + ``` +3. The scraped data can be processed and saved through the pipelines. + +--- + +## Notes +- Ensure all required dependencies are installed (e.g., Flask, Scrapy, pyecharts). +- The web scraping component requires an internet connection and must comply with the target website's scraping policies. +- The `.idea` folder in the project contains IDE configuration files and can be ignored. + +--- + +## License +This project is licensed under the MIT License. For details, please refer to the LICENSE file in the project root directory. + +--- + +## Contributors +Pull Requests and Issues are welcome. Please ensure consistent coding style and provide clear commit messages. + +--- + +## Contact +If you have any questions, please contact the project maintainer or submit an Issue on Gitee. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..74784a5c6a991288b6aeab74428db335fef4039c --- /dev/null +++ b/README.md @@ -0,0 +1,91 @@ +该项目是一个多模块组合项目,包含Flask Web开发、爬虫以及数据可视化等多个功能模块。以下是该项目的简要说明: + +--- + +## 项目结构说明 + +### Flask 模块 +- **1_flask.py**:Flask Web 应用的主程序,包含以下路由: + - `/`:访问根路径,调用 `hello()` 方法。 + - `/index`:访问 `/index` 路径,调用 `index()` 方法。 + - `/get/`:动态路由,接收参数 `name`,并返回对应值。 +- **templates/index.html**:Flask 的模板文件,用于渲染网页内容。 + +### 数据可视化模块 (pyecharts) +- **bar1.py、line1.py、quickstart.py**:使用 pyecharts 生成图表的示例代码。 +- **bar1.html、line1.html、result.html**:生成的 HTML 图表文件,用于展示柱状图、折线图等可视化数据。 + +### 爬虫模块 (Scrapy) +- **game/spiders/a4399game.py**:Scrapy 爬虫模块,用于爬取 4399 游戏网站的数据。 +- **game/items.py**:定义爬取数据的结构(Item)。 +- **game/pipelines.py**:数据处理管道,包含默认和自定义的管道类。 +- **game/middlewares.py**:中间件,用于处理请求和响应。 +- **game/settings.py**:Scrapy 项目的配置文件。 +- **scrapy.cfg**:Scrapy 的配置文件,用于部署和运行爬虫。 + +### 其他文件 +- **.idea/**:IDE 配置文件(如 PyCharm)。 +- **GUI/**:包含 GUI 相关的图片资源(如 `gui.png` 和 `my.gif`)。 + +--- + +## 使用说明 + +### Flask Web 应用 +1. 安装 Flask: + ```bash + pip install flask + ``` +2. 运行 `1_flask.py`: + ```bash + python Flask/1_flask.py + ``` +3. 访问以下 URL: + - `http://127.0.0.1:5000/`:显示 Hello 页面。 + - `http://127.0.0.1:5000/index`:显示 Index 页面。 + - `http://127.0.0.1:5000/get/`:动态显示传入的参数。 + +### 数据可视化 (pyecharts) +1. 安装 pyecharts: + ```bash + pip install pyecharts + ``` +2. 运行示例代码(如 `bar1.py`): + ```bash + python pyecharts/bar1.py + ``` +3. 打开生成的 HTML 文件(如 `bar1.html`)查看图表。 + +### Scrapy 爬虫 +1. 安装 Scrapy: + ```bash + pip install scrapy + ``` +2. 运行爬虫: + ```bash + cd scapy/01scrapy + scrapy crawl a4399game + ``` +3. 爬取的数据可以通过管道进行处理并保存。 + +--- + +## 注意事项 +- 确保安装了所有依赖库(如 Flask、Scrapy、pyecharts)。 +- 爬虫部分需要网络连接,并遵守目标网站的爬取政策。 +- 项目中的 `.idea` 文件夹是 IDE 的配置文件,可忽略。 + +--- + +## 许可证 +该项目遵循 MIT 许可证。详情请查看项目根目录下的 LICENSE 文件。 + +--- + +## 贡献者 +欢迎提交 Pull Request 或 Issue。请确保代码风格一致,并提供清晰的提交信息。 + +--- + +## 联系方式 +如有问题,请联系项目维护者或在 Gitee 上提交 Issue。 \ No newline at end of file