Skip to content

Commit

Permalink
test_mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
99fukong committed Feb 21, 2024
0 parents commit b7c8adf
Show file tree
Hide file tree
Showing 16 changed files with 639 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mysql/
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Python 调试程序: 当前文件",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}
Binary file added __pycache__/lzwtest2.cpython-39.pyc
Binary file not shown.
62 changes: 62 additions & 0 deletions app.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
2024-02-21 17:13:39,199 [WARNING] - * Debugger is active!
2024-02-21 17:13:39,200 [INFO] - * Debugger PIN: 563-124-458
2024-02-21 17:13:52,647 [INFO] - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:6000
* Running on http://192.168.32.3:6000
2024-02-21 17:13:52,651 [INFO] - Press CTRL+C to quit
2024-02-21 17:13:52,652 [INFO] - * Restarting with stat
2024-02-21 17:13:53,007 [WARNING] - * Debugger is active!
2024-02-21 17:13:53,007 [INFO] - * Debugger PIN: 146-148-283
2024-02-21 17:14:11,762 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:11] "GET / HTTP/1.1" 302 -
2024-02-21 17:14:11,864 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:11] "GET /login HTTP/1.1" 200 -
2024-02-21 17:14:12,024 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:12] "GET /static/register.css HTTP/1.1" 200 -
2024-02-21 17:14:12,882 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:12] "GET /favicon.ico HTTP/1.1" 404 -
2024-02-21 17:14:20,555 [INFO] - user is (1, 'lzw', '1234', datetime.datetime(2024, 2, 21, 16, 39, 38))
2024-02-21 17:14:20,564 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:20] "POST /login HTTP/1.1" 500 -
2024-02-21 17:14:20,682 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:20] "GET /login?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
2024-02-21 17:14:20,684 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:20] "GET /login?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
2024-02-21 17:14:20,801 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:20] "GET /login?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
2024-02-21 17:14:21,004 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:14:21] "GET /login?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 304 -
2024-02-21 17:18:30,137 [INFO] - 180.101.245.247 - - [21/Feb/2024 17:18:30] "GET / HTTP/1.1" 302 -
2024-02-21 17:18:30,307 [INFO] - 220.196.160.75 - - [21/Feb/2024 17:18:30] "GET /login HTTP/1.1" 200 -
2024-02-21 17:30:33,283 [INFO] - * Detected change in '/app/lzwtest2.py', reloading
2024-02-21 17:30:33,359 [INFO] - * Restarting with stat
2024-02-21 17:30:33,830 [WARNING] - * Debugger is active!
2024-02-21 17:30:33,830 [INFO] - * Debugger PIN: 146-148-283
2024-02-21 17:30:50,870 [INFO] - * Detected change in '/app/lzwtest2.py', reloading
2024-02-21 17:30:50,898 [INFO] - * Restarting with stat
2024-02-21 17:30:51,102 [WARNING] - * Debugger is active!
2024-02-21 17:30:51,102 [INFO] - * Debugger PIN: 146-148-283
2024-02-21 17:31:25,912 [INFO] - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:6000
* Running on http://192.168.48.3:6000
2024-02-21 17:31:25,913 [INFO] - Press CTRL+C to quit
2024-02-21 17:31:25,914 [INFO] - * Restarting with stat
2024-02-21 17:31:26,302 [WARNING] - * Debugger is active!
2024-02-21 17:31:26,305 [INFO] - * Debugger PIN: 507-475-922
2024-02-21 17:31:38,993 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:31:38] "GET /index HTTP/1.1" 200 -
2024-02-21 17:31:39,356 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:31:39] "GET /static/styles.css HTTP/1.1" 304 -
2024-02-21 17:31:49,022 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:31:49] "GET /index HTTP/1.1" 200 -
2024-02-21 17:31:49,167 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:31:49] "GET /static/styles.css HTTP/1.1" 304 -
2024-02-21 17:32:25,746 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:32:25] "GET / HTTP/1.1" 302 -
2024-02-21 17:32:25,892 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:32:25] "GET /login HTTP/1.1" 200 -
2024-02-21 17:32:26,155 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:32:26] "GET /static/register.css HTTP/1.1" 304 -
2024-02-21 17:32:34,166 [INFO] - user is {'id': 1, 'username': 'lzw', 'password': '1234', 'registration_time': datetime.datetime(2024, 2, 21, 16, 39, 38)}
2024-02-21 17:32:34,167 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:32:34] "POST /login HTTP/1.1" 302 -
2024-02-21 17:32:34,327 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:32:34] "GET /index HTTP/1.1" 200 -
2024-02-21 17:32:34,493 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:32:34] "GET /static/styles.css HTTP/1.1" 304 -
2024-02-21 17:33:25,821 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:33:25] "GET /index HTTP/1.1" 200 -
2024-02-21 17:33:25,941 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:33:25] "GET /static/styles.css HTTP/1.1" 304 -
2024-02-21 17:33:35,978 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:33:35] "GET /index HTTP/1.1" 200 -
2024-02-21 17:33:36,130 [INFO] - 182.102.147.109 - - [21/Feb/2024 17:33:36] "GET /static/styles.css HTTP/1.1" 304 -
2024-02-21 18:13:59,357 [INFO] - 180.101.244.16 - - [21/Feb/2024 18:13:59] "GET /index HTTP/1.1" 302 -
2024-02-21 18:14:00,549 [INFO] - 220.196.160.154 - - [21/Feb/2024 18:14:00] "GET /login HTTP/1.1" 200 -
2024-02-21 18:24:11,366 [INFO] - 180.101.245.250 - - [21/Feb/2024 18:24:11] "GET / HTTP/1.1" 302 -
2024-02-21 18:24:11,542 [INFO] - 59.83.208.108 - - [21/Feb/2024 18:24:11] "GET /login HTTP/1.1" 200 -
2024-02-21 18:24:12,592 [INFO] - 180.101.245.249 - - [21/Feb/2024 18:24:12] "GET / HTTP/1.1" 302 -
2024-02-21 18:24:12,765 [INFO] - 180.101.245.249 - - [21/Feb/2024 18:24:12] "GET /login HTTP/1.1" 200 -
2024-02-21 18:24:13,022 [INFO] - 180.101.245.249 - - [21/Feb/2024 18:24:13] "GET /static/register.css HTTP/1.1" 200 -
2024-02-21 19:18:11,375 [INFO] - 182.102.147.109 - - [21/Feb/2024 19:18:11] "GET /index HTTP/1.1" 200 -
2024-02-21 19:18:11,664 [INFO] - 182.102.147.109 - - [21/Feb/2024 19:18:11] "GET /static/styles.css HTTP/1.1" 304 -
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3.7'

services:
app:
build:
context: .
dockerfile: Dockerfile
# image: my_wob_app:lzw_web
# container_name: flask_app
ports:
- "6070:6000"
volumes:
- ./:/app
depends_on:
- mysql
# environment:
# MYSQL_HOST: mysql
# MYSQL_USER: root
# MYSQL_PASSWORD: 123456
# MYSQL_DB: diary_db
# restart: always
command: python lzwtest2.py
networks:
- net

mysql:
image: mysql:latest
# container_name: mysql_db
# restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: diary_db
ports:
- "3306:3306"
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/config:/etc/mysql/conf.d
networks:
- net

networks:
net:
driver: bridge
15 changes: 15 additions & 0 deletions docker-compose2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
mysql:
image: mysql:latest
restart: always
environment:
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
MYSQL_DATABASE: mydatabase
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql

volumes:
mysql_data:
30 changes: 30 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 使用 Python 3.10 镜像作为基础镜像
FROM python:3.8.18-slim-bullseye

# 将工作目录设置为 /app
WORKDIR /app

RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
&& apt-get update --fix-missing && apt-get install -y --fix-missing \
build-essential

#RUN apt-get update --fix-missing && apt-get install -y --fix-missing \
# build-essential
# #vim

COPY ./requirements.txt /app

# RUN pip install --no-cache-dir -r requirements.txt
RUN pip install -r requirements.txt -i https://mirrors.cloud.tencent.com/pypi/simple

# Expose the port of the container
EXPOSE 9000

# Copy all files in the current directory to /app
COPY . /app


# 运行脚本
# CMD ["bash", "-c", "memoflow/cmd/run.sh"]
# CMD ["bash", "tail", "-f", "/dev/null"]
CMD ["tail", "-f", "/dev/null"]
Loading

0 comments on commit b7c8adf

Please sign in to comment.