Вместо содержимого страницы HTML отображается код - PullRequest
0 голосов
/ 05 марта 2020

Я пишу сайт в Python, Django. После обновления PyCharm на странице HTML в браузере отображается не его содержимое, а код! Что можно сделать с этим?

Вот как это отображается в браузере:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <title>News Agent</title>
</head>
<body>

    <a href="https://www.cbsnews.com/live-updates/coronavirus-outbreak-death-toll-us-infections-latest-news-updates-2020-03-05/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/flat-earth-climate-change-conspiracies-students-teachers-war-on-science-cbsn-originals/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/mcconnell-slams-schumers-comments-on-supreme-court-justices-watch-live-stream-03-05-2020/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/first-coronavirus-death-california-linked-grand-princess-cruise-ship-quarantine/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/lori-vallow-update-extradited-idaho-charges-tylee-ryan-jj-missing/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/james-paul-markowitz-border-patrol-waited-to-call-for-help-after-us-man-who-died-in-custody-showed-signs-distress/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/bernie-sanders-says-joe-biden-should-be-winner-of-democratic-nomination-if-he-has-plurality-of-delegates/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/mlks-son-asks-alabama-to-stop-looming-execution-of-nathaniel-woods/">hhjhj</a>

    <a href="https://www.cbsnews.com/news/stock-markets-down-coronavirus-hit/">hhjhj</a>

</body>
</html>

Код с вида:

def index(request):
    url = "https://www.cbsnews.com/"
    all_links = get_all_links(get_html(url))
    for link in all_links:
         html = get_html(link)

    return render(request, 'main/index.html', {'all_links': all_links})
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...