简体   繁体   English

ubuntu上的django

[英]django on ubuntu

I have done everything said on the following page. 我已经完成了下一页上所说的一切。

https://help.ubuntu.com/community/Django

but it gives me an error page. 但这给了我一个错误页面。

MOD_PYTHON ERROR MOD_PYTHON错误

ProcessId: 2220 Interpreter: ProcessId:2220解释器:
'localhost.localdomain' '称作localhost.localdomain'

ServerName: 服务器名称:
'localhost.localdomain' DocumentRoot: '/etc/apache2/htdocs' 'localhost.localdomain'DocumentRoot:'/ etc / apache2 / htdocs'

URI: '/' Location: URI:“ /”位置:
'/' Directory: None Filename: '/'目录:无文件名:
'/etc/apache2/htdocs' PathInfo: '/ etc / apache2 / htdocs'PathInfo:
'/' '/'

Phase: 'PythonHandler' Handler: 阶段:'PythonHandler'处理程序:
'django.core.handlers.modpython' 'django.core.handlers.modpython'

Traceback (most recent call last): 追溯(最近一次通话):

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) 文件“ /usr/lib/python2.6/dist-packages/mod_python/importer.py”,行1537,在HandlerDispatch中为default = default_handler,arg = req,silent = hlist.silent)

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target result = _execute_target(config, req, object, arg) 文件“ /usr/lib/python2.6/dist-packages/mod_python/importer.py”,第1229行,位于_process_target result = _execute_target(config,req,object,arg)中

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target result = object(arg) _execute_target结果= object(arg)中的文件“ /usr/lib/python2.6/dist-packages/mod_python/importer.py”,行1128

File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 228, in handler return ModPythonHandler()(req) 处理程序中的文件“ /usr/lib/pymodules/python2.6/django/core/handlers/modpython.py”,行228返回ModPythonHandler()(req)

File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 191, in call self.load_middleware() 调用 self.load_middleware()中的文件“ /usr/lib/pymodules/python2.6/django/core/handlers/modpython.py”,第191行

File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 33, in load_middleware for middleware_path in settings.MIDDLEWARE_CLASSES: 在load_middleware中的文件“ /usr/lib/pymodules/python2.6/django/core/handlers/base.py”,行33中,用于settings.MIDDLEWARE_CLASSES中的middleware_path:

File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 276, in getattr self._setup() getattr self._setup()中的文件“ /usr/lib/pymodules/python2.6/django/utils/functional.py”,行276

File "/usr/lib/pymodules/python2.6/django/conf/ init .py", line 40, in _setup self._wrapped = Settings(settings_module) _setup self._wrapped = Settings(settings_module)中的文件“ /usr/lib/pymodules/python2.6/django/conf/ init .py”,第40行

File "/usr/lib/pymodules/python2.6/django/conf/ init .py", line 75, in init raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)) 文件“ /usr/lib/pymodules/python2.6/django/conf/ init .py”,第75行,在init上引发ImportError(“无法导入设置'%s'(在sys.path上吗?它是否具有语法错误?):%s“%(self.SETTINGS_MODULE,e))

ImportError: Could not import settings 'examples.settings' (Is it on sys.path? Does it have syntax errors?): No module named examples.settings ImportError:无法导入设置“ examples.settings”(在sys.path上吗?是否存在语法错误?):没有名为examples.settings的模块

what could be wrong? 有什么问题吗?

complete noob here. 在这里完成菜鸟。

If you are deploying django project for production under ubuntu server it is recommended to use WSGI. 如果要在ubuntu服务器下部署django项目以进行生产,建议使用WSGI。 Just fallow the django documentation: https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/ 只需使用django文档即可: https : //docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/

Installing apache with wsgi under ubuntu is easy: 在ubuntu下使用wsgi安装apache很简单:

apt-get install libapache2-mod-wsgi

In case you just want to explore django you do not need to setup apache or anything. 如果您只想探索Django,则无需设置apache或其他任何工具。 Just use manage.py runserver instead. 只需使用manage.py runserver

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM