Найти - Пользователи
Полная версия: uwsgi с --file работает, а с --module нет
Начало » Python для новичков » uwsgi с --file работает, а с --module нет
1
vasiliy997
Здравствуйте.
Я использую debian wheezy. python2.7, uwsgi, bottle из пакетов.
есть простое приложение:
#site.py
import bottle
@bottle.route("/")
def hello():
    return "Hello, World!"
site=bottle.app()
Если uwsgi запускаю так:
uwsgi --plugin python -s :8081 --module site --callable site
то выдаёт:
Python version: 2.7.3rc2 (default, Apr 22 2012, 22:55:44)
*** Operational MODE: single process ***
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 worker 1 (and the only) (pid: 4849, cores: 1)
а если:
uwsgi --plugin python -s :8081 --file site.py --callable site
то тогда вроде бы нормально запускается:
Python version: 2.7.3rc2 (default, Apr 22 2012, 22:55:44)
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x91bad40 pid: 4854 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 4854, cores: 1)
Почему так?
reclosedev
--module site:site
--module site.site
vasiliy997
при site.site говорит: ImportError: No module named site
при site:site говорит то же самое, что и при –module site –callable site

добавил –pythonpath, создал файл __init__.py, не работает
reclosedev
Может дело в том, что site.py - зарезервированный модуль. Нельзя так свои называть, если только он не в пакете (package.site). Проще переименовать site.py, например, my_site.py.

Еще, ЕМНИП, в bottle app - новый application. Если используется неявная (@bottle.route(“/”)), то нужно
app = default_app()
--module my_site:app
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB