V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
maloneleo88
V2EX  ›  Python

两天了,泪崩, uWSGI 启不来! 求大佬看看

  •  
  •   maloneleo88 · 2022-04-15 19:02:51 +08:00 · 3525 次点击
    这是一个创建于 713 天前的主题,其中的信息可能已经有所发展或是发生改变。

    日志

    *** Starting uWSGI 2.0.18 (64bit) on [Fri Apr 15 18:52:46 2022] ***
    compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-44) on 15 April 2022 10:16:59
    os: Linux-3.10.0-1160.49.1.el7.x86_64 #1 SMP Tue Nov 30 15:51:32 UTC 2021
    nodename: VM-16-9-centos
    machine: x86_64
    clock source: unix
    pcre jit disabled
    detected number of CPU cores: 2
    current working directory: /www/wwwroot/zrhd_bj
    writing pidfile to uwsgi.pid
    detected binary path: /usr/local/bin/uwsgi
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
    chdir() to /www/wwwroot/zrhd_bj/
    your processes number limit is 7265
    your memory page size is 4096 bytes
    detected max file descriptor number: 100001
    lock engine: pthread robust mutexes
    thunder lock: disabled (you can enable it with --thunder-lock)
    probably another instance of uWSGI is running on the same address (127.0.0.1:8000).
    bind(): Address already in use [core/socket.c line 769]
    

    运行没提示错误 [uWSGI] getting INI configuration from uwsgi.ini

    进程就一个 root 5590 0.0 0.0 112812 980 pts/0 S+ 18:59 0:00 grep --color=auto uWSGI

    访问就 503

    求解

    13 条回复    2022-04-16 22:28:22 +08:00
    l4ever
        1
    l4ever  
       2022-04-15 19:04:35 +08:00
    probably another instance of uWSGI is running on the same address (127.0.0.1:8000).
    bind(): Address already in use [core/socket.c line 769]
    hsfzxjy
        2
    hsfzxjy  
       2022-04-15 19:06:59 +08:00 via Android
    你要 grep uwsgi 吧
    cs010
        3
    cs010  
       2022-04-15 19:14:48 +08:00 via Android
    lsof -i :8000
    maloneleo88
        4
    maloneleo88  
    OP
       2022-04-15 19:25:03 +08:00
    新日志
    ```
    *** Starting uWSGI 2.0.18 (64bit) on [Fri Apr 15 19:23:50 2022] ***
    compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-44) on 15 April 2022 10:16:59
    os: Linux-3.10.0-1160.49.1.el7.x86_64 #1 SMP Tue Nov 30 15:51:32 UTC 2021
    nodename: VM-16-9-centos
    machine: x86_64
    clock source: unix
    pcre jit disabled
    detected number of CPU cores: 2
    current working directory: /www/wwwroot/zrhd_bj
    writing pidfile to uwsgi.pid
    detected binary path: /usr/local/bin/uwsgi
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
    chdir() to /www/wwwroot/zrhd_bj/
    your processes number limit is 7265
    your memory page size is 4096 bytes
    detected max file descriptor number: 100001
    lock engine: pthread robust mutexes
    thunder lock: disabled (you can enable it with --thunder-lock)
    uWSGI http bound on 127.0.0.1:8000 fd 4
    uwsgi socket 0 bound to TCP address 127.0.0.1:37372 (port auto-assigned) fd 3
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
    Python version: 3.8.10 (default, Apr 15 2022, 15:06:15) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
    Python main interpreter initialized at 0x1fafb10
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
    python threads support enabled
    your server socket listen backlog is limited to 100 connections
    your mercy for graceful operations on workers is 60 seconds
    mapped 166752 bytes (162 KB) for 2 cores
    *** Operational MODE: threaded ***
    failed to open python file /zrhd_bj/wsgi.py
    unable to load app 0 (mountpoint='') (callable not found or import error)
    *** no app loaded. going in full dynamic mode ***
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
    *** uWSGI is running in multiple interpreter mode ***
    spawned uWSGI master process (pid: 2115)
    spawned uWSGI worker 1 (pid: 2116, cores: 2)
    spawned uWSGI http 1 (pid: 2117)
    ```
    among
        5
    among  
       2022-04-15 19:33:53 +08:00
    failed to open python file /zrhd_bj/wsgi.py
    unable to load app 0 (mountpoint='') (callable not found or import error)
    *** no app loaded. going in full dynamic mode ***
    maloneleo88
        6
    maloneleo88  
    OP
       2022-04-15 19:38:59 +08:00
    @among

    wsgi

    import os

    from django.core.wsgi import get_wsgi_application

    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'zrhd_bj.settings')

    application = get_wsgi_application()

    默认的 没动过呀
    SenLief
        7
    SenLief  
       2022-04-15 19:40:51 +08:00
    这不是提示 8000 端口被占用了吗?换个口试试。
    sujin190
        8
    sujin190  
       2022-04-15 19:43:30 +08:00
    这么明显的错误了吧,要么配置文件目录写错了,要么执行目录弄错了,这个运行方式、启动命令、配置文件都不发没人知道你哪写错了
    cz5424
        9
    cz5424  
       2022-04-15 20:03:12 +08:00 via iPhone
    端口占用
    zeusho871
        10
    zeusho871  
       2022-04-16 05:38:57 +08:00 via Android
    都用 uwsgi 了,试试用 unix socket ?
    Quarter
        11
    Quarter  
       2022-04-16 07:52:36 +08:00 via iPhone
    你这个进程就是你的 grep 啊😅
    elboble
        12
    elboble  
       2022-04-16 16:42:18 +08:00
    是不是 apt 或者 yum 装的 uwsgi ?
    建议删了用 pip install 安装
    maloneleo88
        13
    maloneleo88  
    OP
       2022-04-16 22:28:22 +08:00
    @elboble
    @Quarter
    @zeusho871

    谢谢大家,好了。 就是 uwsgi 单独启动的时候 ip 填 127 启不来 换 4 个 0 就好了, 搭配 nginx 时候再换 127 坑爹玩意
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2583 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 15:55 · PVG 23:55 · LAX 08:55 · JFK 11:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.