在tomcat上部署django

时间:2017-12-07 09:45:04

标签: django tomcat jython-2.7

我在Windows 10的Jython上使用Django 1.8。按照教程https://docs.djangoproject.com/en/1.8/intro/tutorial01创建了一个简单的Django项目。使用buildwar(包括jar)打包后,当我在tomcat中部署mysite.war存档时,出现错误。
我的项目名称是 mysite ,我在web.xml中引用了Jython路径。 我的项目结构是

-mysite
 -WEB-INF
  -lib
   -jruby-extras-fileservlet.jar
   -jython.jar
  -lib-python
   -django
   -doj
   -polls
   -application_settingspy.class
   -application_settings.py
   -eggs.pth
  -web.xml
 -wsgi

错误是

Traceback (most recent call last):
  File "D:\jython27\Lib\modjy\modjy.py", line 80, in service
    self.exc_handler.handle(req, resp, wsgi_environ, mx, (typ, value, tb) )
  File "D:\jython27\Lib\modjy\modjy.py", line 76, in service
    self.dispatch_to_application(req, resp, wsgi_environ)
  File "D:\jython27\Lib\modjy\modjy.py", line 92, in dispatch_to_application
    app_callable = self.get_app_object(req, environ)
  File "D:\jython27\Lib\modjy\modjy_publish.py", line 68, in get_app_object
    return self.get_app_object_old_style(req, environ)
  File "D:\jython27\Lib\modjy\modjy_publish.py", line 120, in        get_app_object_old_style
    return self.load_object(source_filename, callable_name)
  File "D:\jython27\Lib\modjy\modjy_publish.py", line 142, in load_object
    self.raise_exc(NoCallable, "Error loading jython callable '%s': %s" %  (callable_name, str(x)) )
  File "D:\jython27\Lib\modjy\modjy.py", line 121, in raise_exc
    raise exc_class(message)
modjy.modjy_exceptions.NoCallable: Error loading jython callable 'application': No module named mysite

application_settings文件显示:

from mysite.settings import *
CONTEXT_ROOT = "mysite"

0 个答案:

没有答案