python – Django uwsgi nginx.导入错误:没有名为py的模块

前端之家收集整理的这篇文章主要介绍了python – Django uwsgi nginx.导入错误:没有名为py的模块前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在尝试使用uWSGI和Nginx运行我的示例django应用程序.但我得到导入错误,没有名为py的模块.我不知道我应该在哪里添加python路径.

我正在使用以下命令运行.

  1. sudo uwsgi --socket mysite.socket --module wsgi.py --chmod-socket=666.

我甚至尝试在参数–pythonpath中传递路径,仍然是同样的错误.

这就是我的wsgi.py的样子

  1. enter code here
  2. import os
  3. os.environ.setdefault("DJANGO_SETTINGS_MODULE","mysite.settings")
  4. from django.core.wsgi import get_wsgi_application
  5. application = get_wsgi_application()

当我尝试运行时,我收到以下消息

  1. ubuntu@ubuntu1204desktopi386:/usr/local/lib/python2.7/site-packages/mysite/mysite
  2. $sudo uwsgi --socket mysite.socket --module wsgi.py --chmod-socket=666
  3. *** Starting uWSGI 1.9.18.1 (32bit) on [Mon Oct 14 13:15:19 2013] ***
  4. compiled with version: 4.6.3 on 13 October 2013 02:53:51
  5. os: Linux-3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:15:33 UTC 2013
  6. nodename: ubuntu1204desktopi386
  7. machine: i686
  8. clock source: unix
  9. pcre jit disabled
  10. detected number of cpu cores: 1
  11. current working directory: /usr/local/lib/python2.7/site-packages/mysite/mysite
  12. detected binary path: /usr/local/bin/uwsgi
  13. uWSGI running as root,you can use --uid/--gid/--chroot options
  14. *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
  15. *** WARNING: you are running uWSGI without its master process manager ***
  16. your processes number limit is 3846
  17. your memory page size is 4096 bytes
  18. detected max file descriptor number: 1024
  19. lock engine: pthread robust mutexes
  20. thunder lock: disabled (you can enable it with --thunder-lock)
  21. uwsgi socket 0 bound to UNIX address mysite.socket fd 3
  22. Python version: 2.7.3 (default,Sep 26 2013,20:26:19) [GCC 4.6.3]
  23. *** Python threads support is disabled. You can enable it with --enable-threads ***
  24. Python main interpreter initialized at 0x9644d68
  25. your server socket listen backlog is limited to 100 connections
  26. your mercy for graceful operations on workers is 60 seconds
  27. mapped 64024 bytes (62 KB) for 1 cores
  28. *** Operational MODE: single process ***
  29. ImportError: No module named py
  30. unable to load app 0 (mountpoint='') (callable not found or import error)
  31. *** no app loaded. going in full dynamic mode ***
  32. *** uWSGI is running in multiple interpreter mode ***
  33. spawned uWSGI worker 1 (and the only) (pid: 2311,cores: 1)
最佳答案
–module参数可能是一个Python模块,而不是一个文件.所以你可能只需要–module = wsgi.

猜你在找的Nginx相关文章