0
그래서 프로젝트를 로컬에서 테스트했는데 모든 것이 완벽하게 작동하는 것처럼 보입니다.템플릿이 heroku에는 존재하지 않지만 로컬에서는 수행합니다.
프로젝트를 내 영웅 서버에 푸시했는데 하나의 링크를 제외한 모든 것이 작동하지 않는 것 같았습니다. 페이지를 요청할 때/locations/add/error에 TemplateDoesNotExist가 있습니다. 다시 한번이 페이지는 로컬에서 작동하므로 페이지가 존재하지 않는 이유는 무엇입니까? 여기
는 urls.py 조각입니다 :urlpatterns = patterns(
'',
url(r'^add/$', login_required(AddLocation.as_view()), name="add_location"),
)
보기 :
class AddLocation(View):
template_name = "dash/Addlocation.html"
form = locationForm()
def get(self, request, *args, **kwargs):
user = User.objects.get(username=request.user.username)
self.form.fields['existing_regions'].queryset = Region.objects.filter(location__manager=user)
return render(request, self.template_name, {'form': self.form})
및 전체 역 추적 :
: 여기Traceback:
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
22. return view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/views/generic/base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
87. return handler(request, *args, **kwargs)
File "/app/pinpoint/apps/locationmanager/views.py" in get
39. return render(request, self.template_name, {'form': self.form})
File "/app/.heroku/python/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render
53. return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/app/.heroku/python/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
162. t = get_template(template_name)
File "/app/.heroku/python/lib/python2.7/site-packages/django/template/loader.py" in get_template
138. template, origin = find_template(template_name)
File "/app/.heroku/python/lib/python2.7/site-packages/django/template/loader.py" in find_template
131. raise TemplateDoesNotExist(name)
Exception Type: TemplateDoesNotExist at /locations/add/
Exception Value: dash/Addlocation.html
내 템플릿 DIRS 있습니다
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(BASE_DIR, '../templates'),
)
이곳은 요청에 따라 내 설치된 앱입니다 :
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.formtools',
#'rest_framework',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
#'pinpoint.apps.careers',
#'pinpoint.apps.contact',
'pinpoint.profile',
'south',
'pinpoint.apps.beaconmanager',
'pinpoint.apps.api',
'pinpoint.apps.geofencemanager',
'pinpoint.apps.locationmanager',
'pinpoint.apps.messagemanager',
'django_extensions',
)
내 템플릿 로더 :
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
필요한 경우 좀 더 세부 사항을 제공 할 수 있습니다. 누구나 왜이 링크가 영웅에 없지만 로컬에 있는지 알 수 있습니까?
또한 'TEMPLATE_DIRS'및 'INSTALLED_APPS'설정을 표시하십시오. – alecxe
둘 다 추가했는데 내 로더도 포함되어 있습니다. 다시 한번 감사드립니다. – ApathyBear