Files
order/启动服务
2023-10-23 00:13:06 +08:00

115 lines
3.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
进入目录 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
1.自动生成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
2.用环境遍历配置设置
set ops_config=local
3.执行程序
python manager.py runserver
http://127.0.0.1:8999/
//set ops_config=local&&python manager.py runserver
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