Leider wird eine Bildressource (c.jpg im folgenden Sourcecode) nicht geladen. Liegt das etwa daran, dass die die html der HttpResponse als String zusammengebaut wird? Anbei der Code:
Code: Alles auswählen
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
res=""
res=res+"<!DOCTYPE html>"
res=res+"<html>"
res=res+"<head>"
res=res+"<style>"
res=res+"body { background-color:black; }"
res=res+"p { color:white; font-size:50px; }"
res=res+".imag { z-index:-100; position: -webkit-sticky; position: sticky; top: 0; }"
res=res+".main { background-color:black; height:3000px; }"
res=res+"</style>"
res=res+"</head>"
res=res+"<body>"
res=res+"<div class='imag'>"
res=res+"<img src='c.jpg' width='100%' height='500px'></img>"
res=res+"</div>"
res=res+"<div class='main'><p style='color:red;margin-top:0px'>ccccc</p></div>"
res=res+"</div>"
res=res+"</body>"
res=res+"</html>"
return HttpResponse(res)