2

I am deploying my django project, i set up the project on server and once i go to url, i end up seeing this error message.

since the error message is huge, i am adding screenshot here.

http://imagebin.org/279726

I created 500.html and 400.html.

this is my template settings in settings.py on prod server

TEMPLATE_DIRS = (
  "templates",
  os.path.join(PROJECT_PATH, "templates"),
)

what am i doing wrong?

doniyor
  • 36,596
  • 57
  • 175
  • 260
  • What server are you using? How did you set it up? Is your Debug set to True or False? What are you expecting to see- the 500.html or some other template it is not finding? – yuvi Nov 30 '13 at 21:36
  • How your project is deployed, what is variable PROJECT_PATH value? where are actual templates located? – alko Nov 30 '13 at 21:37
  • While you might not realise that yet, I think here is [answer for your question](http://stackoverflow.com/questions/2822422/template-does-not-exist-500-html) – alko Nov 30 '13 at 21:39
  • @yuvi, i am in debian7. i created virtualenv and inside that i installed django and other important packages and created django.fcgi and specified where the prod_settings.py is. now i saw in error log that prod_settings is not found and it says if it on sys.path. – doniyor Nov 30 '13 at 21:43
  • @alko, thanks, i think, my prod_settings.py is not found, thats why it doesnot see template_dirs at all.. – doniyor Nov 30 '13 at 21:44
  • Try adding to your wsgi.py script two lines: `import sys` and then `sys.path.append('path/to/project')`. Do it before the os part that sets the environ for the settings. Did that change anything? – yuvi Nov 30 '13 at 21:53
  • @yuvi, ok let me try this – doniyor Nov 30 '13 at 21:54
  • @yuvi, yes, now it is using prod_settings but now i am getting error saying that it cannot find templates – doniyor Nov 30 '13 at 22:01
  • Good. Now it's a matter of pointing it to the right place for the templates. Obviously, it cannot find one or more of the directories you are pointing to in TEMPLATE_DIRS. Can you share some more of your actual code? – yuvi Nov 30 '13 at 22:08
  • @yuvi, sure. look at this image, i collected important information for you http://imagebin.org/279734 – doniyor Nov 30 '13 at 22:17
  • That's weird. You say he is looking at the right directory. Are you 100% sure `/srv/home/dj574/data/public/wohne_env/templates/index.html` exists? – yuvi Nov 30 '13 at 22:25
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/42258/discussion-between-doniyor-and-yuvi) – doniyor Nov 30 '13 at 22:28
  • Also, your configuration of PROJECT_PATH actually points to the directory of settings.py (abspath doesn't actually do anything there). Try this instead: `PROJECT_PATH = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))` – yuvi Nov 30 '13 at 22:28
  • HUGE PILES of thanks to Yuvi, it is working now – doniyor Nov 30 '13 at 23:04

0 Answers0