I just installed mod_wsgi on server with apache2. I also installed django.
我刚刚在服务器上用apache2安装了mod_wsgi。我也安装了django。
I created project and app inside project (in fact I uploaded app from my local machine).
我在项目中创建了项目和应用程序(事实上我从本地机器上传了应用程序)。
The url-view mapping in my app works but when view tries to render any template there is TemplateDoesNotExist exception.
我的应用程序中的url-view映射有效,但当视图尝试呈现任何模板时,会出现TemplateDoesNotExist异常。
All my templates are in /[project]/[app]/templates/[app] (there are also some sub directories in this directory such "elements" and "errors" with specific templates)
我的所有模板都在/ [project] / [app] / templates / [app]中(此目录中还有一些子目录,例如“elements”和“errors”,带有特定的模板)
Anyway it seems that django/wsgi doesn see the templates in my app - on my local machine {with django developement server) it works ok and django finds templates in my [app]/templates directory.
无论如何,似乎django / wsgi没有看到我的应用程序中的模板 - 在我的本地机器上{与django开发服务器)它工作正常,django在我的[app] / templates目录中找到模板。
I am render templates using this path "[app]/base.html" or "[app]/elements/some_elements.html"
我使用此路径“[app] /base.html”或“[app] /elements/some_elements.html”呈现模板
in my httpd.conf:
在我的httpd.conf中:
WSGIScriptAlias /wsgi /var/src/[project]/[project]/wsgi.py
WSGIPythonPath /var/src/[project]/
<Directory /var/src/[project]>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
1 个解决方案
#1
1
Do you have TEMPLATE_DIRS in settings.py pointing at the correct location for this server?
您是否在settings.py中指向TEMPLATE_DIRS指向此服务器的正确位置?
#1
1
Do you have TEMPLATE_DIRS in settings.py pointing at the correct location for this server?
您是否在settings.py中指向TEMPLATE_DIRS指向此服务器的正确位置?