У меня проблема с использованием шаблона в Google App Engine от Python.Дело в том, что когда я обращаюсь к своей статической папке в Yaml, я не могу получить доступ к своему шаблону, и когда я удаляю его, он становится доступным.посмотрите на файлы.
this is my file structure
-src\
----\calc.py
----\main.py
----\index.html
----templ\
---------\calc.html
---------\js
---------\css
YAML:
handlers:
- url: /.* script: main.py
MAIN.PY
def main():
application = webapp.WSGIApplication([
('/', MainPage),
('/calc',Calc)
], debug=True)
wsgiref.handlers.CGIHandler().run(application)
Calc.py
class Calc(webapp.RequestHandler):
def get(self):
temp = os.path.join(os.path.dirname(__file__), 'templ/calc.html')
outstr = template.render(temp, temp_val)
self.response.out.write(outstr)
РЕЗУЛЬТАТ ЕСТЬ: Статус: 200 ОК Тип контента: text / html;charset = utf-8 Я могу получить доступ к своему файлу, и адресация шаблона работает
BUTTTTTTT
, когда я добавляю следующую строку в свой YAML для доступа к моим css и js и т. д.на.ИТ не имеет доступа
YAML:
handlers:
- url: /.*
script: main.py
- url: /templ
static_dir: templ
or If i change order of them :
YAML:
handlers:
- url: /templ
static_dir: templ
- url: /.*
script: main.py
ОБА НЕ работают, и есть моя ошибка
Статус: 500 Внутренняя ошибка сервера
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
handler.get(*groups)
File "/Users/em/Documents/workspace/NerkhARZ/src/calc.py", line 26, in get
outstr = template.render(temp, temp_val)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/template.py", line 88, in render
t = load(template_path, debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/template.py", line 185, in load
return _load_user_django(path, debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/template.py", line 110, in _load_user_django
template = django.template.loader.get_template(file_name)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_0_96/django/template/loader.py", line 79, in get_template
source, origin = find_template_source(template_name)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_0_96/django/template/loader.py", line 72, in find_template_source
raise TemplateDoesNotExist, name
TemplateDoesNotExist: calc.html
Пожалуйста, помогите мне через это, должно быть простое решение для этого.Я действительно не верю, что GAE - это так много дураков ...
Спасибо за продвинутый