2014-06-10 67 views
0

我是openshift的n00b,我遇到了Django项目的问题。Django无法找到fandjango模板(应用程序已安装)

我已经安装这些应用程序:

'django.contrib.admin', 
'django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'fandjango', 
'schedule', #nuestras app particulares 
'accounts' 

作为scheduleaccounts自定义应用程序。

我将这个(整个项目,我的意思是)从一个现有的工作openshift托管迁移。当我安装了所有需求(包括fandjango)之后,一切都奏效了,但是必不可少:一个未找到的模板(已经安装了它的应用并且不知道发生了什么)以及相应的例外情况。

TemplateDoesNotExist at /fbapp/ 
fandjango/facebook_init.html 

,如果我检查了尸体:

Django tried loading these templates, in this order: 
    Using loader django.template.loaders.filesystem.Loader: 
     /var/lib/openshift/5397226f5004467c0a00044d/app-root/runtime/repo/mundial2014/templates/fandjango/facebook_init.html (File does not exist) 
    Using loader django.template.loaders.app_directories.Loader: 
     /var/lib/openshift/5397226f5004467c0a00044d/python/virtenv/lib/python2.7/site-packages/Django-1.6-py2.7.egg/django/contrib/admin/templates/fandjango/facebook_init.html (File does not exist) 
     /var/lib/openshift/5397226f5004467c0a00044d/python/virtenv/lib/python2.7/site-packages/Django-1.6-py2.7.egg/django/contrib/auth/templates/fandjango/facebook_init.html (File does not exist) 
     /var/lib/openshift/5397226f5004467c0a00044d/app-root/runtime/repo/schedule/templates/fandjango/facebook_init.html (File does not exist) 
     /var/lib/openshift/5397226f5004467c0a00044d/app-root/runtime/repo/accounts/templates/fandjango/facebook_init.html (File does not exist) 

我的问题是:为什么不-the app_directories装载机遍历文件?如果我打开一个python控制台并尝试import fandjango它的工作(即print fandjango)输出模块表示。

的设置模板装载机是Django的1.6(文件系统和应用程序的目录)和我的模板显示目录设置默认为:

TEMPLATE_DIRS = (os.path.join(os.path.dirname(BASE_DIR), 'mundial2014', 'templates'),) 

回答

1

明白了。以某种方式安装:

python setup.py install 

不创建目录([...])/ site-packages/fandjango但只留下.egg文件。所以我不得不pip uninstall fandjango,然后pip install fandjango正确安装django应用程序(这次创建的目录)。

相关问题