diff --git a/flask框架网址 b/flask框架网址 new file mode 100644 index 0000000..6f60ce3 --- /dev/null +++ b/flask框架网址 @@ -0,0 +1,2 @@ +flask框架 +http://docs.jinkan.org/docs/flask/quickstart.html#a-minimal-application \ No newline at end of file diff --git a/linux数据库操作 b/linux数据库操作 new file mode 100644 index 0000000..30678a5 --- /dev/null +++ b/linux数据库操作 @@ -0,0 +1,17 @@ +linux数据库操作 +mysql -uroot -p +数据库密码:123456 +创建数据表 +数据库名:food_db +CREATE DATABASE `food_db` DEFAULT CHARACTER SET = `utf8mb4`; +查看表 +show databases; +进入数据表 +use food_db; +show tables; +select * from user ; +show create table user; + + +1. 开启mysql service mysqld start +2. 查看mysql是否开启 ps -ef |grep mysql \ No newline at end of file diff --git a/启动服务 b/启动服务 index b1cccff..61aa5dc 100644 --- a/启动服务 +++ b/启动服务 @@ -1,60 +1,5 @@ -进入目录 cd imooc_env/ -开启虚拟环境 source bin/activate -source imooc_env/bin/activate - -开启共享目录: mount -t vboxsf mooc /home/www -cd /home/www -ls - -运行helloword -如果在虚拟环境中打开浏览器不让访问,则需要关闭防火墙 -service firewalld stop - -python hello.py -192.168.31.107:5000 -192.168.31.107:5000/imooc/hello -可以看到页面有内容输出 -//使用本地测试环境 -export ops_config=local&&python manager.py runserver - -postman本地环境测试接口 -192.168.31.106:8999/user/login -http://192.168.31.105:8998/api/food/inde - -http://192.168.31.105:8998/api/member/logintwo - -http://106.52.204.179/api/food/index - -http://192.168.31.105:8999/api/member/deviceinfo -线上服务器接口 -http://106.52.204.179:8999/user/login -http://106.52.204.179:8999/api/member/logintwo - -http://106.52.204.179:8999/api/food/index - -http://106.52.204.179:8999/api/member/deviceinfo -linux数据库操作 -mysql -uroot -p -数据库密码:123456 -创建数据表 -数据库名:food_db -CREATE DATABASE `food_db` DEFAULT CHARACTER SET = `utf8mb4`; -查看表 -show databases; -进入数据表 -use food_db; -show tables; -select * from user ; -show create table user; - -flask框架 -http://docs.jinkan.org/docs/flask/quickstart.html#a-minimal-application - 1. 开启mysql service mysqld start - 2. 查看mysql是否开启 ps -ef |grep mysql - 腾讯云mysql密码:~renjianbo0118mysql*&; - 线上服务器操作 xhell连接腾讯云: ssh root@106.52.204.179 密码:~renjianbo0118 用户名:root @@ -78,37 +23,4 @@ export ops_config=local&&python manager.py runserver http://127.0.0.1:9000/ -停服务 -service nginx stop -killall -s INT /data/www/python3_vir/bin/uwsgi -开服务 -source /data/www/python3_vir/bin/activate -cd /data/www/python3_vir -source bin/activate -cd /data/www/order -export ops_config=production&&python manager.py runserver -uwsgi --ini uwsgi.ini -cd /data/www/logs -tail -f order.log (查看服务启起来了) -ps -ef |grep uwsgi(查看多进程) - -cd /etc/nginx/conf.d -service nginx start -ps -ef |grep nginx(查看ng启动起来了) -service nginx reload - -https://python815.cn/user/login -http://python815.cn/user/login -https://www.python815.cn/user/login -http://www.python815.cn/user/login -http://106.52.204.179/user/login -账号:54php.cn 密码123456789 -账号:吃货:密码:123456 -账号:54php.cn2 密码:123456 -账号:猪猪侠2 密码:123456789 -卸载mysql -https://blog.csdn.net/li_wei_quan/article/details/78549891 - -线上测试api -http://106.52.204.179/api/food/index diff --git a/启动线上服务器 b/启动线上服务器 new file mode 100644 index 0000000..4240101 --- /dev/null +++ b/启动线上服务器 @@ -0,0 +1,33 @@ +停服务 +service nginx stop +killall -s INT /data/www/python3_vir/bin/uwsgi +开服务 +source /data/www/python3_vir/bin/activate +cd /data/www/python3_vir +source bin/activate +cd /data/www/order +export ops_config=production&&python manager.py runserver +uwsgi --ini uwsgi.ini +cd /data/www/logs +tail -f order.log (查看服务启起来了) +ps -ef |grep uwsgi(查看多进程) + +cd /etc/nginx/conf.d +service nginx start +ps -ef |grep nginx(查看ng启动起来了) +service nginx reload + +https://python815.cn/user/login +http://python815.cn/user/login +https://www.python815.cn/user/login +http://www.python815.cn/user/login +http://106.52.204.179/user/login +账号:54php.cn 密码123456789 +账号:吃货:密码:123456 +账号:54php.cn2 密码:123456 +账号:猪猪侠2 密码:123456789 +卸载mysql +https://blog.csdn.net/li_wei_quan/article/details/78549891 + +线上测试api +http://106.52.204.179/api/food/index \ No newline at end of file diff --git a/启动线下服务器 b/启动线下服务器 new file mode 100644 index 0000000..e0a491c --- /dev/null +++ b/启动线下服务器 @@ -0,0 +1,15 @@ +进入目录 cd imooc_env/ +开启虚拟环境 source bin/activate +source imooc_env/bin/activate +开启共享目录: mount -t vboxsf mooc /home/www +cd /home/www +ls +运行helloword +如果在虚拟环境中打开浏览器不让访问,则需要关闭防火墙 +service firewalld stop +python hello.py +192.168.31.107:5000 +192.168.31.107:5000/imooc/hello +可以看到页面有内容输出 +//使用本地测试环境 +export ops_config=local&&python manager.py runserver \ No newline at end of file diff --git a/建表 b/建表 index 7ca976e..0f5fca4 100644 --- a/建表 +++ b/建表 @@ -30,5 +30,15 @@ create TABLE `user` ( 在orderr目录下输入 flask-sqlacodegen " mysql://root:~renjianbo0118mysql*&;@127.0.0.1/food_db" --tables deviceinfo --outfile "common/models/member/DeviceInfo.py" --flask +自动生成modles +flask-sqlacodegen " mysql://root:123456@127.0.0.1/food_db" --tables membermiya --outfile "common/models/member/Membermiya.py" --flask +flask-sqlacodegen " mysql://root:123456@127.0.0.1/food_db" --tables member --outfile "common/models/member/Member.py" --flask +flask-sqlacodegen " mysql://root:123456@127.0.0.1/food_db" --tables oauth_member_bind --outfile "common/models/member/Oauth_member_bind.py" --flask +flask-sqlacodegen " mysql://root:123456@127.0.0.1/food_db" --tables mendianusertwo --outfile "common/models/Mendianusertwo.py" --flask +flask-sqlacodegen " mysql://root:123456@127.0.0.1/food_db" --tables mendianuserinfo --outfile "common/models/member/Mendianuserinfo.py" --flask +flask-sqlacodegen " mysql://root:123456@127.0.0.1/food_db" --tables deviceinfo --outfile "common/models/member/DeviceInfo.py" --flask +flask-sqlacodegen " mysql://root:~renjianbo0118mysql*&;@127.0.0.1/food_db" --tables deviceinfo --outfile "common/models/member/DeviceInfo.py" --flask + + 3.修改自动生成的model中的db变量 (很重要) from application import db \ No newline at end of file diff --git a/验证线上服务器接口 b/验证线上服务器接口 new file mode 100644 index 0000000..f72471c --- /dev/null +++ b/验证线上服务器接口 @@ -0,0 +1,21 @@ +线上服务器接口 +http://106.52.204.179:8999/user/login +http://106.52.204.179:8999/api/member/logintwo + +http://106.52.204.179:8999/api/food/index + +http://106.52.204.179:8999/api/member/deviceinfo + + + + +线下服务器接口 +postman本地环境测试接口 +192.168.31.106:8999/user/login +http://192.168.31.105:8998/api/food/inde + +http://192.168.31.105:8998/api/member/logintwo + +http://106.52.204.179/api/food/index + +http://192.168.31.105:8999/api/member/deviceinfo \ No newline at end of file