python - Template doesn't exist on heroku, but does locally -
so tested project locally, , seems work perfectly.
although, when pushed project heroku server, except 1 link didn't seem work. when requesting page, got templatedoesnotexist @ /locations/add/ error. once again, page works locally, how can page doesn't exist?
here urls.py snippet:
urlpatterns = patterns( '', url(r'^add/$', login_required(addlocation.as_view()), name="add_location"), )
the view:
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})
and full traceback:
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 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 @ /locations/add/ exception value: dash/addlocation.html
here template dirs:
template_dirs = ( # put strings here, "/home/html/django_templates" or "c:/www/django/templates". # use forward slashes, on windows. # don't forget use absolute paths, not relative paths. os.path.join(base_dir, '../templates'), )
and here installed apps requested:
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 next line enable admin: 'django.contrib.admin', # uncomment next line 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', )
my template loaders:
template_loaders = ( 'django.template.loaders.filesystem.loader', 'django.template.loaders.app_directories.loader', # 'django.template.loaders.eggs.loader', )
i can provide more details if needed. know why link doesn't exist on heroku locally?
okay have realized wrong.
two things:
- the urls.py app needed
django.core.urlresolvers import reverse
- the
template_name = "dash/addlocation.html"
needed changedtemplate_name = "dash/addlocation.html"
thanks pointed me in right direction.
Comments
Post a Comment