开发者

Django - Loading templates from different project folder?

Issue: Beta site is pulling from primary site templates folder, below is a skeleton structure of the site folder structure - store is the hosted project dir for DOMAIN.com beta/store goes to beta.DOMAIN.com

the site is hosted

Dir Structure

Project/
  apache
    site.wsgi
  beta
    apache
      site.wsgi
    logs
    store
      [APPS]
      media
      templates
  logs
  store
    [APPS]
    media
    templates

settings.py (relavent portions)

import os

DIRNAME = os.path.dirname(__file__)

TEMPLATE_DIRS = (
    os.path.join(DIRNAME, 'templates/'),
)

console from PROJECT/beta/store

>>> from django.conf import settings
>>> settings.DIRNAME
'/home/python/mykornhole/beta/store'
>>> settings.TEMPLATE_DIRS
('/home/python/mykornhole/beta/store/../store/templates/',)
>>> 

Question: How can I get the beta site to render templates from the proper directory?

The Console shows that the TEMPLATE_DIRS directory is the proper one, but when I change something o开发者_运维问答n a template from /PROJECT/store/templates it renders on the beta page, when I make a change to a /PROJECT/beta/store/templates template it is ignored

th media folder and others are showing updates, just note the templates...

any ideas?


I think the confusion may be related to having your beta site as a subdirectory of your production(?) site.

What is the value of DIRNAME? The TEMPLATE_DIRS value of'/home/python/mykornhole/beta/store/../store/templates/' would seem to indicate DIRNAME is '/home/python/mykornhole/beta/store/../store/' which doesn't feel right.

In the future I recommend keeping beta and production in entirely separate directory trees.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜