Я пытаюсь обслуживать статический HTML -файл, но возвращает ошибку 500
(копия Editor.html находится на каталоге .py и шаблонов)
Это все, что я пробовал: < /p>
from flask import Flask
app = Flask(__name__, static_url_path='/templates')
@app.route('/')
def hello_world():
#return 'Hello World1!' #this works correctly!
#return render_template('editor.html')
#return render_template('/editor.html')
#return render_template(url_for('templates', filename='editor.html'))
#return app.send_static_file('editor.html') #404 error (Not Found)
return send_from_directory('templates', 'editor.html')
< /code>
Это ответ: < /p>
Title: 500 Internal Server Srror
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Подробнее здесь: https://stackoverflow.com/questions/245 ... tatic-html
Колба: Как подавать статический HTML? ⇐ Html
Программисты Html
1746254836
Anonymous
Я пытаюсь обслуживать статический HTML -файл, но возвращает ошибку 500
(копия Editor.html находится на каталоге .py и шаблонов)
Это все, что я пробовал: < /p>
from flask import Flask
app = Flask(__name__, static_url_path='/templates')
@app.route('/')
def hello_world():
#return 'Hello World1!' #this works correctly!
#return render_template('editor.html')
#return render_template('/editor.html')
#return render_template(url_for('templates', filename='editor.html'))
#return app.send_static_file('editor.html') #404 error (Not Found)
return send_from_directory('templates', 'editor.html')
< /code>
Это ответ: < /p>
Title: 500 Internal Server Srror
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Подробнее здесь: [url]https://stackoverflow.com/questions/24578330/flask-how-to-serve-static-html[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия