Closed MBfromOK closed 4 years ago
Realized I didn't send the actual traceback:
TemplateDoesNotExist at /admin/person/person/add/ by Django Environment:
Request Method: GET Request URL: http://127.0.0.1:8000/admin/person/person/add/
Django Version: 3.0.5 Python Version: 3.7.7 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'import_export', 'person'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']
Template loader postmortem Django tried loading these templates, in this order:
Using engine django:
Template error: In template D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\contrib\admin\templates\admin\includes\fieldset.html, error at line 19 phone_field/phone_widget.html 9 : {% for field in line %} 10 : <div{% if not line.fields|length_is:'1' %} class="fieldBox{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}> 11 : {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %} 12 : {% if field.is_checkbox %} 13 : {{ field.field }}{{ field.label_tag }} 14 : {% else %} 15 : {{ field.label_tag }} 16 : {% if field.is_readonly %} 17 :
Traceback (most recent call last): File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\backends\django.py", line 34, in get_template return Template(self.engine.get_template(template_name), self) File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\engine.py", line 143, in get_template template, origin = self.find_template(template_name) File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\engine.py", line 129, in find_template raise TemplateDoesNotExist(name, tried=tried)
The above exception (phone_field/phone_widget.html) was the direct cause of the following exception:
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\backends\django.py", line 61, in render
return self.template.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 171, in render
return self._render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 163, in _render
return self.nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 163, in _render
return self.nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 163, in _render
return self.nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\defaulttags.py", line 209, in render
nodelist.append(node.render_annotated(context))
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\loader_tags.py", line 188, in render
return template.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 173, in render
return self._render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 163, in _render
return self.nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\defaulttags.py", line 209, in render
nodelist.append(node.render_annotated(context))
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\defaulttags.py", line 209, in render
nodelist.append(node.render_annotated(context))
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\defaulttags.py", line 309, in render
return nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\defaulttags.py", line 309, in render
return nodelist.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 936, in render
bit = node.render_annotated(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 903, in render_annotated
return self.render(context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 992, in render
return render_value_in_context(output, context)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\base.py", line 971, in render_value_in_context
value = str(value)
File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\utils\html.py", line 373, in
The above exception (phone_field/phone_widget.html) was the direct cause of the following exception: File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\core\handlers\exception.py", line 34, in inner response = get_response(request) File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\core\handlers\base.py", line 145, in _get_response response = self.process_exception_by_middleware(e, request) File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\core\handlers\base.py", line 143, in _get_response response = response.render() File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\response.py", line 105, in render self.content = self.rendered_content File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\response.py", line 83, in rendered_content return template.render(context, self._request) File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\backends\django.py", line 63, in render reraise(exc, self.backend) File "D:\Dev\VSCode\Projects\Portal\env\lib\site-packages\django\template\backends\django.py", line 84, in reraise raise new from exc
Exception Type: TemplateDoesNotExist at /admin/person/person/add/ Exception Value: phone_field/phone_widget.html
Could it be related to the solution found here: Django TemplateDoesNotExist?
chown -R www-data:www-data /usr/lib/python2.5/site-packages/projectname/*
If so, how would I do that in my non-server dev environment?
Hi,
I'd check your Django config:
phone_field
included in your settings.INSTALLED_APPS
?I am betting this is my fault; my app worked until I converted my phone number TextField to your phone_field...
Things I tried: I made migrations, migrated, and then deleted the db and started over. Upgraded to Python 3.8.2 64bit and 32bit I am running my project in a venv and I pip installed while the env was activated... Seems to work until I try to render the view.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'phone_field',
'products',
'pages',
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
let me know if you need more / different information.
As I said, I am guessing your app is fine... Thanks for whatever help you provide!
'DIRS': [],
in your TEMPLATES
setting so it is only relying on app dirsdjango-admin startproject testproj
and putting in the bare minimum (a simple model with a phone_field
field and an admin or template view). There was something not setting correctly... again, probably something I did... Build a completely new project directory and then copy pasted my files back. Works like a dream!
i have same issues , and i try every solution without results , please if anyone can help me
TemplateDoesNotExist at /admin/person/person/add/
phone_field/phone_widget.html