相关文章推荐
酷酷的鸵鸟  ·  Ubuntu ...·  1 年前    · 
沉稳的鸭蛋  ·  spark ...·  1 年前    · 

I am getting following exception on Azure App service even though I do not have any problem locally. It can not find my templates. django.template.exceptions.TemplateDoesNotExist: Home/index.html

Please help me. I tried with several python versions.
And Why is App service putting my application to /tmp/8d8a3ff4a30bd7f/ folder ? Should not it put my application to wwwroot folder ?

2020-12-19T09:35:47.419034805Z Detected an app based on Django
2020-12-19T09:35:47.419993568Z Generating ptvsd command for 'manage runserver --noreload --nothreading $HOST:$PORT'
2020-12-19T09:35:47.809020997Z Writing output script to '/opt/startup/startup.sh'
2020-12-19T09:35:48.356337272Z Using packages from virtual environment antenv3.6 located at /tmp/8d8a3ff4a30bd7f/antenv3.6.
2020-12-19T09:35:48.357410655Z Updated PYTHONPATH to ':/tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages'
2020-12-19T09:36:08.702558746Z /tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages/pandas/core/ops/ init .py:1115: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
2020-12-19T09:36:08.702623547Z result = method(y)
2020-12-19T09:36:08.972229942Z Not Found: /robots933456.txt
2020-12-19T09:36:08.980432840Z [19/Dec/2020 09:36:08] "GET /robots933456.txt HTTP/1.1" 404 3349

2020-12-19T09:38:20.111967184Z Internal Server Error: /
2020-12-19T09:38:20.112018884Z Traceback (most recent call last):
2020-12-19T09:38:20.112025184Z File "/tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-12-19T09:38:20.112037184Z response = get_response(request)
2020-12-19T09:38:20.112040784Z File "/tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
2020-12-19T09:38:20.112044284Z response = self.process_exception_by_middleware(e, request)
2020-12-19T09:38:20.112066284Z File "/tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
2020-12-19T09:38:20.112069984Z response = wrapped_callback(request, *callback_args, **callback_kwargs)
2020-12-19T09:38:20.112073584Z File "/tmp/8d8a3ff4a30bd7f/App/views.py", line 62, in index
2020-12-19T09:38:20.112077084Z return render(request, 'Home/index.html')
2020-12-19T09:38:20.112080484Z File "/tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages/django/shortcuts.py", line 36, in render
2020-12-19T09:38:20.112083984Z content = loader.render_to_string(template_name, context, request, using=using)
2020-12-19T09:38:20.112087484Z File "/tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages/django/template/loader.py", line 61, in render_to_string
2020-12-19T09:38:20.112091084Z template = get_template(template_name, using=using)
2020-12-19T09:38:20.112094484Z File "/tmp/8d8a3ff4a30bd7f/antenv3.6/lib/python3.6/site-packages/django/template/loader.py", line 19, in get_template
2020-12-19T09:38:20.112097984Z raise TemplateDoesNotExist(template_name, chain=chain)
2020-12-19T09:38:20.112101484Z django.template.exceptions.TemplateDoesNotExist: Home/index.html

open your App service via FTP (you may find FTP url and credentials for App service in Azure portal > App service > Deployment center > FTP) and ensure that templates are provisioned in the correct sub folder under site's root folder. If they are not here - create folder and copy them manually via FTP client.

You may also move whole app to the wwwroot manually. Not sure why it was created in tmp sub folder in your case.