Discussion:
Django Tutorial02 / TEMPLATE_DIRS
code_berzerker
2008-01-16 19:22:23 UTC
Permalink
In Django Tutorial02 theres TEMPLATE_DIRS setting with path to
templates. I copied some admin templates doing exactly as tutorial
says.

I'm using current SVN Django build.
I put my templates somewhere in /var/www/ just beside project code and
media files.

What may be the reason that django doesnt see these templates?

regars
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Rajesh Dhawan
2008-01-16 19:36:06 UTC
Permalink
Hi,
Post by code_berzerker
In Django Tutorial02 theres TEMPLATE_DIRS setting with path to
templates. I copied some admin templates doing exactly as tutorial
says.
I'm using current SVN Django build.
I put my templates somewhere in /var/www/ just beside project code and
media files.
What may be the reason that django doesnt see these templates?
Make sure that:

1. settings.TEMPLATE_LOADERS contains the entry
django.template.loaders.filesystem.load_template_source before the
entry django.template.loaders.app_directories.load_template_source

2. the path specified in TEMPLATE_DIRS has no typos

3. the user you are running the Django application as has read/write
access to that template directory. Are you using the built-in
development server (python manage.py runserver) or an external web
server (Apache)? If it's the latter, you will need to make sure that
the user that Apache runs as has access to that template directory.

-Rajesh D

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
code_berzerker
2008-01-17 11:16:56 UTC
Permalink
Post by Rajesh Dhawan
1. settings.TEMPLATE_LOADERS contains the entry
django.template.loaders.filesystem.load_template_source before the
entry django.template.loaders.app_directories.load_template_source
the order is correct
Post by Rajesh Dhawan
2. the path specified in TEMPLATE_DIRS has no typos
path is verified via commandline (cd /path/to/tpl/) and was correct
Post by Rajesh Dhawan
3. the user you are running the Django application as has read/write
access to that template directory. Are you using the built-in
development server (python manage.py runserver) or an external web
server (Apache)? If it's the latter, you will need to make sure that
the user that Apache runs as has access to that template directory.
I use devserver and even setting 777 on the directory tree for
templates doesnt help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Collin Grady
2008-01-17 04:33:34 UTC
Permalink
Post by code_berzerker
I put my templates somewhere in /var/www/ just beside project code and
media files.
If /var/www is a web root, your project code should *not* be there.
Don't ever put django code in a web-readable directory if you can help
it :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
code_berzerker
2008-01-17 11:18:46 UTC
Permalink
Post by Collin Grady
Post by code_berzerker
I put my templates somewhere in /var/www/ just beside project code and
media files.
If /var/www is a web root, your project code should *not* be there.
Don't ever put django code in a web-readable directory if you can help
it :)
Thanx, I will use your advice when I put django app on production
server :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
code_berzerker
2008-01-17 16:26:41 UTC
Permalink
Trying to solve the problem I added following code to settings.py:

ALLOWED_INCLUDE_ROOTS = (
'/var/www',
)

but it didnt help.

I skipped this error for a bit and continued with tutorial and heres
backtrace of what happened later and also my settings.py content.

******************************
* backtrace: *
******************************

TemplateDoesNotExist at /test/djtest/polls/
polls/index.html
Request Method: GET
Request URL: http://192.168.233.129:8080/test/djtest/polls/
Exception Type: TemplateDoesNotExist
Exception Value: polls/index.html
Exception Location: /usr/lib/python2.5/site-packages/django/template/
loader.py in find_template_source, line 72
Python Executable: /usr/bin/python
Python Version: 2.5.1
Python Path: ['/var/www/test/djtest/mysite', '/usr/lib/python25.zip',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/
python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/
python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/
lib/python2.5/site-packages/Numeric', '/var/lib/python-support/
python2.5']
Template-loader postmortem

Django tried loading these templates, in this order:

* Using loader
django.template.loaders.filesystem.load_template_source:
* Using loader
django.template.loaders.app_directories.load_template_source:
o /usr/lib/python2.5/site-packages/django/contrib/admin/
templates/polls/index.html (File does not exist)

Traceback Switch to copy-and-paste view

* /usr/lib/python2.5/site-packages/django/core/handlers/base.py in
get_response
75. # Apply view middleware
76. for middleware_method in self._view_middleware:
77. response = middleware_method(request, callback,
callback_args, callback_kwargs)
78. if response:
79. return response
80.
81. try:
82. response = callback(request, *callback_args,
**callback_kwargs) ...
83. except Exception, e:
84. # If the view raised an exception, run it through
exception
85. # middleware, and if the exception middleware returns a
86. # response, use that. Otherwise, reraise the exception.
87. for middleware_method in self._exception_middleware:
88. response = middleware_method(request, e)
▼ Local vars
Variable Value
callback
<function index at 0x86d8b1c>
callback_args
()
callback_kwargs
{}
debug
<module 'django.views.debug' from '/usr/lib/python2.5/site-
packages/django/views/debug.pyc'>
e
TemplateDoesNotExist('polls/index.html',)
exceptions
<module 'django.core.exceptions' from '/usr/lib/python2.5/site-
packages/django/core/exceptions.pyc'>
mail_admins
<function mail_admins at 0x86cc95c>
middleware_method
<bound method XViewMiddleware.process_view of
<django.middleware.doc.XViewMiddleware object at 0x86d2bec>>
request
<WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:
{'sessionid': '54170faf598f4c6a41c2be99843f5d7c'}, META:
{'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'text/plain',
'DJANGO_SETTINGS_MODULE': 'mysite.settings', 'GATEWAY_INTERFACE': 'CGI/
1.1', 'HISTCONTROL': 'ignoreboth', 'HOME': '/home/notroot',
'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-
us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION':
'keep-alive', 'HTTP_COOKIE':
'sessionid=54170faf598f4c6a41c2be99843f5d7c', 'HTTP_HOST':
'192.168.233.129:8080', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT':
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/
20071127 Firefox/2.0.0.11', 'HUSHLOGIN': 'FALSE', 'LANG':
'en_US.UTF-8', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'LESSOPEN': '| /
usr/bin/lesspipe %s', 'LOGNAME': 'notroot', 'LS_COLORS':
'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:',
'MAIL': '/var/mail/notroot', 'OLDPWD': '/var/www/test/djtest', 'PATH':
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/
games', 'PATH_INFO': '/test/djtest/polls/', 'PWD': '/var/www/test/
djtest/mysite', 'QUERY_STRING': '', 'REMOTE_ADDR': '192.168.233.1',
'REMOTE_HOST': '', 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true',
'SCRIPT_NAME': '', 'SERVER_NAME': 'ubuntu.localdomain', 'SERVER_PORT':
'8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/
0.1 Python/2.5.1', 'SHELL': '/bin/bash', 'SHLVL': '1', 'TERM':
'linux', 'TZ': 'Europe/Warsaw', 'USER': 'notroot', '_': '/usr/bin/
python', 'wsgi.errors': <open file '<stderr>', mode 'w' at
0xb7d4e0b0>, 'wsgi.file_wrapper': <class
'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input':
<socket._fileobject object at 0x8689e9c>, 'wsgi.multiprocess': False,
'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme':
'http', 'wsgi.version': (1, 0)}>
resolver
<RegexURLResolver mysite.urls ^/>
response
None
self
<django.core.handlers.wsgi.WSGIHandler object at 0x82fbf8c>
settings
<django.conf.LazySettings object at 0xb7c992ac>
urlconf
'mysite.urls'
urlresolvers
<module 'django.core.urlresolvers' from '/usr/lib/python2.5/site-
packages/django/core/urlresolvers.pyc'>
* /var/www/test/djtest/mysite/../mysite/polls/views.py in index
1. from django.template import Context, loader
2. from mysite.polls.models import Poll
3. from django.http import HttpResponse
4.
5. def index(request):
6. latest_poll_list = Poll.objects.all().order_by('-pub_date')
[:5]
7. t = loader.get_template('polls/index.html') ...
8. c = Context({
9. 'latest_poll_list': latest_poll_list,
10. })
11. return HttpResponse(t.render(c))
12.
13. def detail(request, poll_id):
▼ Local vars
Variable Value
latest_poll_list
[<Poll: What's up?>, <Poll: HA HA>]
request
<WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:
{'sessionid': '54170faf598f4c6a41c2be99843f5d7c'}, META:
{'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'text/plain',
'DJANGO_SETTINGS_MODULE': 'mysite.settings', 'GATEWAY_INTERFACE': 'CGI/
1.1', 'HISTCONTROL': 'ignoreboth', 'HOME': '/home/notroot',
'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-
us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION':
'keep-alive', 'HTTP_COOKIE':
'sessionid=54170faf598f4c6a41c2be99843f5d7c', 'HTTP_HOST':
'192.168.233.129:8080', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT':
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/
20071127 Firefox/2.0.0.11', 'HUSHLOGIN': 'FALSE', 'LANG':
'en_US.UTF-8', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'LESSOPEN': '| /
usr/bin/lesspipe %s', 'LOGNAME': 'notroot', 'LS_COLORS':
'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:',
'MAIL': '/var/mail/notroot', 'OLDPWD': '/var/www/test/djtest', 'PATH':
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/
games', 'PATH_INFO': '/test/djtest/polls/', 'PWD': '/var/www/test/
djtest/mysite', 'QUERY_STRING': '', 'REMOTE_ADDR': '192.168.233.1',
'REMOTE_HOST': '', 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true',
'SCRIPT_NAME': '', 'SERVER_NAME': 'ubuntu.localdomain', 'SERVER_PORT':
'8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/
0.1 Python/2.5.1', 'SHELL': '/bin/bash', 'SHLVL': '1', 'TERM':
'linux', 'TZ': 'Europe/Warsaw', 'USER': 'notroot', '_': '/usr/bin/
python', 'wsgi.errors': <open file '<stderr>', mode 'w' at
0xb7d4e0b0>, 'wsgi.file_wrapper': <class
'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input':
<socket._fileobject object at 0x8689e9c>, 'wsgi.multiprocess': False,
'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme':
'http', 'wsgi.version': (1, 0)}>
* /usr/lib/python2.5/site-packages/django/template/loader.py in
get_template
72. raise TemplateDoesNotExist, name
73.
74. def get_template(template_name):
75. """
76. Returns a compiled Template object for the given template
name,
77. handling template inheritance recursively.
78. """
79. source, origin = find_template_source(template_name) ...
80. template = get_template_from_string(source, origin,
template_name)
81. return template
82.
83. def get_template_from_string(source, origin=None,
name=None):
84. """
85. Returns a compiled Template object for the given template
code,
▼ Local vars
Variable Value
template_name
'polls/index.html'
* /usr/lib/python2.5/site-packages/django/template/loader.py in
find_template_source
65. template_source_loaders.append(func)
66. for loader in template_source_loaders:
67. try:
68. source, display_name = loader(name, dirs)
69. return (source, make_origin(display_name, loader, name,
dirs))
70. except TemplateDoesNotExist:
71. pass
72. raise TemplateDoesNotExist, name ...
73.
74. def get_template(template_name):
75. """
76. Returns a compiled Template object for the given template
name,
77. handling template inheritance recursively.
78. """
▼ Local vars
Variable Value
dirs
None
loader
<function load_template_source at 0x8764a04>
name
'polls/index.html'

Environment: Request Method: GET Request URL: http://192.168.233.129:8080/test/djtest/polls/
Django Version: 0.97-pre-SVN-unknown Python Version: 2.5.1 Installed
Applications: ['django.contrib.auth', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sites',
'django.contrib.admin', 'mysite.polls'] Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware') Template Loader Error: Django
tried loading these templates, in this order: Using loader
django.template.loaders.filesystem.load_template_source: Using loader
django.template.loaders.app_directories.load_template_source: /usr/lib/
python2.5/site-packages/django/contrib/admin/templates/polls/
index.html (File does not exist) Traceback: File "/usr/lib/python2.5/
site-packages/django/core/handlers/base.py" in get_response 82.
response = callback(request, *callback_args, **callback_kwargs) File "/
var/www/test/djtest/mysite/../mysite/polls/views.py" in index 7. t =
loader.get_template('polls/index.html') File "/usr/lib/python2.5/site-
packages/django/template/loader.py" in get_template 79. source, origin
= find_template_source(template_name) File "/usr/lib/python2.5/site-
packages/django/template/loader.py" in find_template_source 72. raise
TemplateDoesNotExist, name Exception Type: TemplateDoesNotExist at /
test/djtest/polls/ Exception Value: polls/index.html

Request information
GET

No GET data
POST

No POST data
COOKIES
Variable Value
sessionid
'54170faf598f4c6a41c2be99843f5d7c'
META
Variable Value
CONTENT_LENGTH
''
CONTENT_TYPE
'text/plain'
DJANGO_SETTINGS_MODULE
'mysite.settings'
GATEWAY_INTERFACE
'CGI/1.1'
HISTCONTROL
'ignoreboth'
HOME
'/home/notroot'
HTTP_ACCEPT
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5'
HTTP_ACCEPT_CHARSET
'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
HTTP_ACCEPT_ENCODING
'gzip,deflate'
HTTP_ACCEPT_LANGUAGE
'en-us,en;q=0.5'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
'sessionid=54170faf598f4c6a41c2be99843f5d7c'
HTTP_HOST
'192.168.233.129:8080'
HTTP_KEEP_ALIVE
'300'
HTTP_USER_AGENT
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/
20071127 Firefox/2.0.0.11'
HUSHLOGIN
'FALSE'
LANG
'en_US.UTF-8'
LESSCLOSE
'/usr/bin/lesspipe %s %s'
LESSOPEN
'| /usr/bin/lesspipe %s'
LOGNAME
'notroot'
LS_COLORS
'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:'
MAIL
'/var/mail/notroot'
OLDPWD
'/var/www/test/djtest'
PATH
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/
games'
PATH_INFO
'/test/djtest/polls/'
PWD
'/var/www/test/djtest/mysite'
QUERY_STRING
''
REMOTE_ADDR
'192.168.233.1'
REMOTE_HOST
''
REQUEST_METHOD
'GET'
RUN_MAIN
'true'
SCRIPT_NAME
''
SERVER_NAME
'ubuntu.localdomain'
SERVER_PORT
'8080'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'WSGIServer/0.1 Python/2.5.1'
SHELL
'/bin/bash'
SHLVL
'1'
TERM
'linux'
TZ
'Europe/Warsaw'
USER
'notroot'
_
'/usr/bin/python'
wsgi.errors
<open file '<stderr>', mode 'w' at 0xb7d4e0b0>
wsgi.file_wrapper
<class 'django.core.servers.basehttp.FileWrapper'>
wsgi.input
<socket._fileobject object at 0x8689e9c>
wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
Settings
Using settings module mysite.settings
Setting Value
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
()
ADMIN_FOR
()
ADMIN_MEDIA_PREFIX
'/test/djtest/pub/media/'
ALLOWED_INCLUDE_ROOTS
'/var/www'
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
('django.contrib.auth.backends.ModelBackend',)
BANNED_IPS
()
CACHE_BACKEND
'locmem://'
CACHE_MIDDLEWARE_KEY_PREFIX
''
CACHE_MIDDLEWARE_SECONDS
600
COMMENTS_ALLOW_PROFANITIES
False
COMMENTS_BANNED_USERS_GROUP
None
COMMENTS_FIRST_FEW
0
COMMENTS_MODERATORS_GROUP
None
COMMENTS_SKETCHY_USERS_GROUP
None
DATABASE_ENGINE
'mysql'
DATABASE_HOST
''
DATABASE_NAME
'django'
DATABASE_OPTIONS
{}
DATABASE_PASSWORD
'********************'
DATABASE_PORT
''
DATABASE_USER
'django_user'
DATETIME_FORMAT
'N j, Y, P'
DATE_FORMAT
'N j, Y'
DEBUG
True
DEFAULT_CHARSET
'utf-8'
DEFAULT_CONTENT_TYPE
'text/html'
DEFAULT_FROM_EMAIL
'***@localhost'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
()
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_USE_TLS
False
FILE_CHARSET
'utf-8'
FIXTURE_DIRS
()
IGNORABLE_404_ENDS
('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico',
'.php')
IGNORABLE_404_STARTS
('/cgi-bin/', '/_vti_bin', '/_vti_inf')
INSTALLED_APPS
['django.contrib.auth', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sites',
'django.contrib.admin', 'mysite.polls']
INTERNAL_IPS
()
JING_PATH
'/usr/bin/jing'
LANGUAGES
(('ar', 'Arabic'), ('bn', 'Bengali'), ('bg', 'Bulgarian'), ('ca',
'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de',
'German'), ('el', 'Greek'), ('en', 'English'), ('es', 'Spanish'),
('es_AR', 'Argentinean Spanish'), ('fa', 'Persian'), ('fi',
'Finnish'), ('fr', 'French'), ('ga', 'Gaeilge'), ('gl', 'Galician'),
('hu', 'Hungarian'), ('he', 'Hebrew'), ('hr', 'Croatian'), ('is',
'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ko', 'Korean'),
('km', 'Khmer'), ('kn', 'Kannada'), ('lv', 'Latvian'), ('mk',
'Macedonian'), ('nl', 'Dutch'), ('no', 'Norwegian'), ('pl', 'Polish'),
('pt', 'Portugese'), ('pt-br', 'Brazilian'), ('ro', 'Romanian'),
('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sr',
'Serbian'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('te', 'Telugu'),
('tr', 'Turkish'), ('uk', 'Ukrainian'), ('zh-cn', 'Simplified
Chinese'), ('zh-tw', 'Traditional Chinese'))
LANGUAGES_BIDI
('he', 'ar', 'fa')
LANGUAGE_CODE
'en-us'
LOCALE_PATHS
()
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_URL
'/accounts/logout/'
MANAGERS
()
MEDIA_ROOT
''
MEDIA_URL
''
MIDDLEWARE_CLASSES
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware')
MONTH_DAY_FORMAT
'F j'
PREPEND_WWW
False
PROFANITIES_LIST
'********************'
ROOT_URLCONF
'mysite.urls'
SECRET_KEY
'********************'
SEND_BROKEN_LINK_EMAILS
False
SERVER_EMAIL
'***@localhost'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
'/tmp/'
SESSION_SAVE_EVERY_REQUEST
False
SETTINGS_MODULE
'mysite.settings'
SITE_ID
1
TEMPLATE_CONTEXT_PROCESSORS
('django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media')
TEMPLATE_DEBUG
True
TEMPLATE_DIRS
()
TEMPLATE_LOADERS
('django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source')
TEMPLATE_STRING_IF_INVALID
''
TEST_DATABASE_CHARSET
None
TEST_DATABASE_COLLATION
None
TEST_DATABASE_NAME
None
TEST_RUNNER
'django.test.simple.run_tests'
TIME_FORMAT
'P'
TIME_ZONE
'Europe/Warsaw'
TRANSACTIONS_MANAGED
False
URL_VALIDATOR_USER_AGENT
u'Django/0.97-pre-SVN-unknown (http://www.djangoproject.com)'
USE_ETAGS
False
USE_I18N
True
YEAR_MONTH_FORMAT
'F Y'

You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 500 page.


******************************
* settings.py: *
******************************


# Django settings for mysite project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', '***@domain.com'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '*******' # Or path to database file if
using sqlite3.
DATABASE_USER = '*******' # Not used with sqlite3.
DATABASE_PASSWORD = '********' # Not used with sqlite3.
DATABASE_HOST = '' # 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. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be avilable on all operating systems.
# If running in a Windows environment this must be set to the same as
your
# system time zone.
TIME_ZONE = 'Europe/Warsaw'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as
not
# to load the internationalization machinery.
USE_I18N = True

# 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. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
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 = '/test/djtest/pub/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '*******************'

# 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 = 'mysite.urls'

ALLOWED_INCLUDE_ROOTS = (
'/var/www',
)

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/var/www/test/djtest/tpl',
#"/home/html/djtest/tpl",
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'mysite.polls',
)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Karen Tracey
2008-01-17 17:09:28 UTC
Permalink
Somehow you are not using the version of the settings.py file you
think you are. See below.
Post by code_berzerker
ALLOWED_INCLUDE_ROOTS = (
'/var/www',
)
Just FYI, as far as I know, this setting is only used for the ssi
tag. The tutorial doesn't use that, does it? So I don't believe this
is needed.

[much snipped]
Post by code_berzerker
Settings
Using settings module mysite.settings
Setting Value
[more snipped]
Post by code_berzerker
TEMPLATE_DIRS
()
[more snipped]
Post by code_berzerker
******************************
* settings.py: *
******************************
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/var/www/test/djtest/tpl',
#"/home/html/djtest/tpl",
)
So, though the settings.py you posted has TEMPLATE_DIRS with your '/
var/www...' directory listed, the one you are running with has no
TEMPLATE_DIRS.

Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
code_berzerker
2008-01-17 19:08:26 UTC
Permalink
Post by Karen Tracey
So, though the settings.py you posted has TEMPLATE_DIRS with your '/
var/www...'directory listed, the one you are running with has no
TEMPLATE_DIRS.
Yes I've noticed that, but I use settings.py listed above. Django uses
db configuration from that file and other things too. Somehow
TEMPLATE_DIRS gets cleared or filtered. for example if I run python
manage.py shell from project dir and inspect settings module it is
empty. I'm kinda new to Python and Django, so I may actually do some
stupid mistake on the way. I'm getting frustrated enough to convinve
myself to use pdb to run that code step by step. I dont know how to
use pdb and it scares me yet.... Still considering installing Django
on windows and trying to debug it through Eric or SPE (but since winxp
is different platform I can get different issues and that holds me off
it).

BTW if it does matter I've setup Ubuntu (just shell, no X-Windows) on
VMWare and using it as development server from windows xp.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Karen Tracey
2008-01-18 00:11:10 UTC
Permalink
Post by code_berzerker
Post by Karen Tracey
So, though the settings.py you posted has TEMPLATE_DIRS with your '/
var/www...'directory listed, the one you are running with has no
TEMPLATE_DIRS.
Yes I've noticed that, but I use settings.py listed above. Django uses
db configuration from that file and other things too. Somehow
TEMPLATE_DIRS gets cleared or filtered. for example if I run python
manage.py shell from project dir and inspect settings module it is
empty. I'm kinda new to Python and Django, so I may actually do some
stupid mistake on the way. I'm getting frustrated enough to convinve
myself to use pdb to run that code step by step. I dont know how to
use pdb and it scares me yet.... Still considering installing Django
on windows and trying to debug it through Eric or SPE (but since winxp
is different platform I can get different issues and that holds me off
it).
Check the value of settings.__file__ from python manage.py shell after
importing settings, just to make sure it is using the file you think it is.
I don't see any code in Django that would filter or clear that setting, so
my first inclination is to think it is using some other settings file than
what you are expecting.

I can't help with pdb, coming most recently from a Java background to Django
I already had Eclipse up and running and it was easy enough to add PyDev to
that for debugging Django stuff, so that is what I tend to use.

BTW if it does matter I've setup Ubuntu (just shell, no X-Windows) on
Post by code_berzerker
VMWare and using it as development server from windows xp.
I don't know of any reason why that shouldn't work, but it is outside my
experience. I develop primarily on Ubuntu, but also have a couple spare old
Windows machines I try things out on from time to time. FWIW I've never had
any great difficulty getting Django stuff running on Windows.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
code_berzerker
2008-01-18 11:12:31 UTC
Permalink
[...]
Post by Karen Tracey
Check the value of settings.__file__ from python manage.py shell after
importing settings, just to make sure it is using the file you think it is.
I don't see any code in Django that would filter or clear that setting, so
my first inclination is to think it is using some other settings file than
what you are expecting.
I did this:

python manage.py shell
Post by Karen Tracey
import settings
settings.__file__
and it showed value of my app settings file just as I was expecting.
Post by Karen Tracey
I can't help with pdb, coming most recently from a Java background to Django
I already had Eclipse up and running and it was easy enough to add PyDev to
that for debugging Django stuff, so that is what I tend to use.
I also use PyDev, but I run it on windows and use Remote Site Explorer
to modify files directly on linux virtual machine. This way I cant do
remote debugging. And debuging it on win xp probably wouldnt solve
issue coz paths and permitions on windows and linux differ too much.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Rock
2008-01-18 01:01:36 UTC
Permalink
The templates have to be within a directory named "templates" found in
the /var/www/ directory.
BUT DON'T PUT TEMPLATES THERE! Put the templates dir in the same
directory as your settings.py
file and set the path accordingly in the settings.py file.


Here is another good alternative:

Comment out the filesystem loading option. This means that the second
loader (which is the
app_directories template loader) will be used exclusively. Now put
your templates file within
your application directory, i.e., myapp/templates/ and put the
templates in there. Now you
don't have to specify an absolute path in the settings.py file for
template loading.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
code_berzerker
2008-01-18 11:15:52 UTC
Permalink
Post by Rock
The templates have to be within a directory named "templates" found in
the /var/www/ directory.
BUT DON'T PUT TEMPLATES THERE! Put the templates dir in the same
directory as your settings.py
file and set the path accordingly in the settings.py file.
Comment out the filesystem loading option. This means that the second
loader (which is the
app_directories template loader) will be used exclusively. Now put
your templates file within
your application directory, i.e., myapp/templates/ and put the
templates in there. Now you
don't have to specify an absolute path in the settings.py file for
template loading.
I might try that as a last thing, coz its avoiding not solving the
issue ;) And I want to know whats wrong to be able to prevent it to
hapen in the future.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Rajesh Dhawan
2008-01-18 18:38:51 UTC
Permalink
Perhaps try removing all comment cruft from your
settings.TEMPLATE_DIRS so it's just this:

TEMPLATE_DIRS = ('/var/www/test/djtest/tpl',) # <-- remember to put a
trailing comma here




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
code_berzerker
2008-01-19 11:13:00 UTC
Permalink
This was one of my most stupid problems. PyDev with RSE was not saving
file fo linux virtual machine correctly and this caused the problem.

Thank you for all the help. I hope, I'll come up with wiser problems
next time ;)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Continue reading on narkive:
Loading...