Python论坛  - 讨论区

标题:[python-chinese] hi .有一个fcgi下配置django应用报TemplateDoesNotExist错误的问题

2007年05月02日 星期三 08:15

Kula kulasama在gmail.com
星期三 五月 2 08:15:09 HKT 2007

大家好.

我刚刚在51boo上购买了一个django空间.然后想把自己的应用配置上去.但我发现51boo上采用的是fastcgi来运行django.我本机使用的是mod-python.然后程序放到服务器上报内部服务器500错误
.
     我在51boo上用django自带的服务器运行.结果是正常的.然后我照着51boo上的教程写了一个django.fcgi.
     #!/usr/bin/env python
import sys,os
sys.path += ['','/var/www/virtual/kula.51boo.com/htdocs/']
os.environ['DJANGO_SETTINGS_MODULE']='web.settings'
from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
server=WSGIServer(WSGIHandler(),maxThreads=50)
server.run()

然后重启fcgi.然后在我域名上看.报internal server 500 error.
然后我在本机执行python django.fcgi.返回一个django
可以运行.但是有django.template.templatedoesnotexist错误.
我怀疑是我的setting文件有问题.
setting.py:



DEBUG = False
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email at domain.com'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'mysql'           # 'postgresql', 'mysql', 'sqlite3' or
'ado_mssql'.
DATABASE_NAME = 'XXX'             # Or path to database file if using
sqlite3.
DATABASE_USER = 'XXX'             # Not used with sqlite3.
DATABASE_PASSWORD = 'XXX'         # Not used with sqlite3.
DATABASE_HOST = 'XXX'             # Set to empty string for localhost. Not
used with sqlite3.
DATABASE_PORT = ''             # Set to empty string for default. Not used
with sqlite3.

# Local time zone for this installation. All choices can be found here:
#
http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
TIME_ZONE = 'gmt-8'

# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'zh-cn'

SITE_ID = 1

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use
a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'b!z4+n^-lms$z^+(iqvm9wr49lnjk##r&98)ztwu^!v3-yl_fx'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
#     'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.doc.XViewMiddleware',
)

ROOT_URLCONF = 'web.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates".
    # Always use forward slashes, even on Windows.
    '/var/www/virtual/kula.51boo.com/htdocs/web/template/'
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'web.forum'
)
css = './source/css'

请问一下可能是哪个地方出问题了
**
**
**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070502/7f758ee6/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月02日 星期三 08:24

Kula kulasama在gmail.com
星期三 五月 2 08:24:50 HKT 2007

如果我把django debug设置为true.然后在ssh下run django.fcgi
就会报
Request Method: GET Request URL: http:// Exception Type: TypeError Exception
Value: unpack non-sequence Exception Location:
/usr/local/lib/python2.5/site-packages/Django-0.95.1-py2.5.egg/django/core/handlers/base.py
in get_response, line 65
这个错误.
why...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070502/8731677b/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月08日 星期二 10:26

haur hekun06在gmail.com
星期二 五月 8 10:26:11 HKT 2007

51booÉϲÉÓõÄÊÇfastcgiÀ´ÔËÐÐdjango ...  ΪʲôÊÇÕâÑùÄØ ??

ÔÚ07-5-2£¬Kula <kulasama在gmail.com> дµÀ£º
>
> Èç¹ûÎÒ°Ñdjango debugÉèÖÃΪtrue.È»ºóÔÚsshÏÂrun django.fcgi
> ¾Í»á±¨
> Request Method: GET Request URL: http:// Exception Type: TypeError Exception
> Value: unpack non-sequence Exception Location:
> /usr/local/lib/python2.5/site-packages/Django-0.95.1-py2.5.egg/django/core/handlers/base.py
> in get_response, line 65
> Õâ¸ö´íÎó.
> why...
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070508/c69b6293/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年05月08日 星期二 11:00

limodou limodou在gmail.com
星期二 五月 8 11:00:22 HKT 2007

On 5/8/07, haur <hekun06在gmail.com> wrote:
>
> 51booÉϲÉÓõÄÊÇfastcgiÀ´ÔËÐÐdjango ...  ΪʲôÊÇÕâÑùÄØ ??
>
> ÒòΪ²ÉÓÃmod_pythonµÄ»°£¬Ò»µ©Ð޸ĵijÌÐò£¬ÒªÖØÆôapache¡£ÕâÊǼþºÜÂé·³µÄÊ£¬ÌرðÊǶÔÓÚÐéÄâÖ÷»úÌṩÕßÀ´Ëµ¡£

-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070508/99350c9f/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号