当我使用多个设置模块时,Django会引发Template DoesNotExist

时间:2016-04-28 19:41:42

标签: python django git python-2.7

我正在尝试使用多个设置模块,一个用于生产,一个基础和一个本地不会进入版本控制(在我的情况下是git)。 Django引发TemplateDoesExist,模板就在那里。我的所有设置文件都在里面的设置文件夹中。

这是base.py: http://pastebin.com/Ek4vzyCa

这是local.py:http://pastebin.com/S9AAVhH8

这是production.py:http://pastebin.com/Zw8bhBfk

manage.py:http://pastebin.com/i4AAP1Ce

Internal Server Error: /
Traceback (most recent call last):
File "/home/sebastian/Envs/Spartan/local/lib/python2.7/site-packages      /django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/sebastian/Envs/Spartan/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/sebastian/Documents/project-spartan/basicpages/views.py", line 24, in home
'categories': categories
File "/home/sebastian/Envs/Spartan/local/lib/python2.7/site-packages/django/shortcuts.py", line 67, in render
template_name, context, request=request, using=using)
File "/home/sebastian/Envs/Spartan/local/lib/python2.7/site-packages/django/template/loader.py", line 96, in render_to_string
template = get_template(template_name, using=using)

文件" /home/sebastian/Envs/Spartan/local/lib/python2.7/site-packages/django/template/loader.py",第43行,在get_template中     提升TemplateDoesNotExist(template_name,chain = chain) TemplateDoesNotExist:basicpages / index.html [28 / Apr / 2016 19:47:48]" GET / HTTP / 1.1" 500 86041

1 个答案:

答案 0 :(得分:0)

您可以使用settings命令中的runserver参数仅对本地开发使用设置:

$ python manage.py runserver --settings=Spartan.local

所以你可以只推送git生产设置。