勤勉敦敏 2022-01-22 11:29 采纳率: 83.3%
浏览 597
已结题

django配置uwsgi提示ModuleNotFoundError: No module named 'django' unable to load app 0 (mountpoint='')

问题遇到的现象和发生背景

ubuntu没有用虚拟环境,直接安装
使用uwsgi --http :8000 --chdir /home/cc/web1 --module web1.wsgi启动正常
用uwsgi.ini启动报错

*** Operational MODE: preforking ***
Traceback (most recent call last):
  File "/home/cc/web1/./web1/wsgi.py", line 13, in <module>
    from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 2323)
spawned uWSGI worker 1 (pid: 2326, cores: 1)
spawned uWSGI worker 2 (pid: 2327, cores: 1)
spawned uWSGI worker 3 (pid: 2328, cores: 1)
spawned uWSGI worker 4 (pid: 2329, cores: 1)
spawned uWSGI worker 5 (pid: 2330, cores: 1)
spawned uWSGI http 1 (pid: 2331)
--- no python application found, check your startup logs for errors ---

问题相关代码,请勿粘贴截图
运行结果及报错内容

单独运行wsgi.py

cc@ubuntu:~/web1/web1$ python wsgi.py
['/home/cc/web1/web1', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/cc/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']
Traceback (most recent call last):
  File "wsgi.py", line 18, in <module>
    application = get_wsgi_application()
  File "/home/cc/.local/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/home/cc/.local/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/cc/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 84, in __getattr__
    self._setup(name)
  File "/home/cc/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 71, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/cc/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 179, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'web1'


我的解答思路和尝试过的方法
我想要达到的结果
  • 写回答

1条回答 默认 最新

  • 唯羽 2022-01-22 13:52
    关注

    python的绝对路径是哪?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 1月30日
  • 已采纳回答 1月22日
  • 修改了问题 1月22日
  • 创建了问题 1月22日

悬赏问题

  • ¥30 基于信创PC发布的QT应用如何跨用户启动后输入中文
  • ¥20 非root手机,如何精准控制手机流量消耗的大小,如20M
  • ¥15 远程安装一下vasp
  • ¥15 自己做的代码上传图片时,报错
  • ¥15 Lingo线性规划模型怎么搭建
  • ¥15 关于#python#的问题,请各位专家解答!区间型正向化
  • ¥15 unity从3D升级到urp管线,打包ab包后,材质全部变紫色
  • ¥50 comsol温度场仿真无法模拟微米级激光光斑
  • ¥15 上传图片时提交的存储类型
  • ¥15 VB.NET如何绘制倾斜的椭圆