码迷,mamicode.com
首页 > 其他好文 > 详细

项目问题

时间:2020-04-09 20:22:24      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:call   uwsgi   pes   post   root   turn   mod   sys   chdir   

  1. uwsgi中报错:File "./AdminSystem/wsgi.py", line 12, in
    from django.core.wsgi import get_wsgi_application
    ImportError: No module named django.core.wsgi

unable to load app 0 (mountpoint=‘‘) (callable not found or import error)
--- no python application found, check your startup logs for errors ---

猜测原因应该是某些环境变量没有加到配置中,找了一个解决办法,但是忘记博客的网址了,所以把答案记录下来。就是在etc/profile中加上一句话:export PATH=/usr/local/bin:$PATH

  1. nginx配置

events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;

upstream www.pay.xinxiajiaoyu.cn {

server 127.0.0.1:8001;

}

upstream loginay{

server 127.0.0.1:8002;
}
server {
listen 8002;
server_name 127.0.0.1; # 改为自己的域名,没域名修改为127.0.0.1:80
charset utf-8;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8808; # 端口要和uwsgi里配置的一样
uwsgi_param UWSGI_SCRIPT AdminSystem.wsgi; #wsgi.py所在的目录名+.wsgi
uwsgi_param UWSGI_CHDIR /home/subject/AdminSystem/; # 项目路径
}
location /static {
alias /home/subject/AdminSystem/static;
}
}
server {
listen 80;
server_name www.pay.xinxiajiaoyu.cn;
charset utf-8;
location / {
root /home/html; # html访问路径
index index.html; # html文件名称
try_files $uri $uri/ /index.html; # 解决单页面应用刷新404问
}
location /api/uniPayApi.action { #post请求反向代理,像该域名发送请求
# return 307;
proxy_method POST;
proxy_pass https://www.joinpay.com/trade/uniPayApi.action;
proxy_redirect default;
}
location /api/fastpaySmsApi.action {
proxy_pass https://www.joinpay.com/trade/fastpaySmsApi.action;
}
location /api/fastpayPayApi.action {
proxy_pass https://www.joinpay.com/trade/fastpayPayApi.action;
}
location /accounts/loginay { #反向代理,请求accounts/loginay直接
proxy_pass http://loginay;
}
}
}

   ```

3.uwsgi的配置

<uwsgi>
<socket>127.0.0.1:8808</socket>
<chdir>/home/subject/AdminSystem/</chdir>
<module>AdminSystem.wsgi</module>
<processes>10</processes>
<daemonize>uwsgi.log</daemonize>
</uwsgi>

项目问题

标签:call   uwsgi   pes   post   root   turn   mod   sys   chdir   

原文地址:https://www.cnblogs.com/michealjy/p/12669220.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!