参考:https://www.cnblogs.com/cleven/p/10911099.html
【uwsgi.ini】
[uwsgi]
http=0.0.0.0:8080
pythonpath = /home/ubuntu/myprojects/myflask
wsgi-file=mytest.py #问题出在这里:这里需要绝对路径。。。
callable=app
processes=4
threads=2
master=True
logto=log.txt
【解决方案】
wsgi-file = /home/ubuntu/myprojects/myflask/mytest.py
配置文件构成:
/etc/nginx/nginx.conf
└ /etc/nginx/conf.d/flask.conf
└ /etc/nginx/sites-enable/default
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default\_type application/octet-stream;
ssl\_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl\_prefer\_server\_ciphers on;
access\_log /var/log/nginx/access.log;
error\_log /var/log/nginx/error.log;
gzip on;
gzip\_disable "msie6";
include /etc/nginx/conf.d/\*.conf;
include /etc/nginx/sites-enabled/\*; #问题出在这里
}
server {
listen 80;
server_name 49.234.18.49;
root /home/ubuntu/myprojects/myflask;
location / {
include uwsgi_params;
uwsgi_pass localhost:8080;
}
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server\_name \_;
location / {
try\_files $uri $uri/ =404;
}
}
【原因】
nginx.conf中include了两个地址,其中 /etc/nginx/sites-enabled/* 占用了80端口,导致flask.conf设置的端口失效。
解决方法就是注释掉这一行:# /etc/nginx/sites-enabled/* ;
【原因】
新建虚拟环境的时候出错导致的,排查了一晚上,谨记谨记!
注:神tm虚拟环境中sudo pip install 的时候是安装到实际环境中去的!!!
[思路]
vue router 懒加载
查看uwsgi的Log如下:
File "/home/ubuntu/release/myblog_flask_v2/app/models.py", line 104, in get_jwt
return jwt.encode(
AttributeError: module 'jwt' has no attribute 'encode'
【原因】
包装错了啊
错误包:jwt
正确包:pyjwt
emmmm….
手机扫一扫
移动阅读更方便
你可能感兴趣的文章