I build VueJs app and copy all static files to django static folder and copy vuejs index.html to django templates folder
but when refresh page it raise 404
here is my index.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>FMS</title>
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport>
<link rel=stylesheet href=https://use.fontawesome.com/releases/v5.8.1/css/all.css
integrity=sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf crossorigin=anonymous>
<link href=https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css rel=stylesheet>
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css>
<link rel=stylesheet href=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
integrity=sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u crossorigin=anonymous>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons"
rel=stylesheet>
<link href="{% static "/css/app.6c7cbd2b6c8e41a0245180734aee4192.css" %}" rel=stylesheet>
</head>
</head>
<script src=/socket.io/socket.io.js></script>
<body class="skin-blue sidebar-mini">
<div id=app></div>
<script>if (window.navigator.userAgent.indexOf("Edge") > -1) {
window.fetch = undefined;
}</script>
<script type=text/javascript src=./src/main.js></script>
<script src=https://code.jquery.com/jquery-3.3.1.slim.min.js
integrity=sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo
crossorigin=anonymous></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js
integrity=sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1
crossorigin=anonymous></script>
<script src=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
integrity=sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa
crossorigin=anonymous></script>
<script src=https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.2/socket.io.js></script>
<script type=text/javascript src="{% static "/js/manifest.e9739da6f5c27d585419.js" %}"></script>
<script type=text/javascript src="{% static "/js/vendor.7deff2a26292e503ec19.js" %}"></script>
<script type=text/javascript src="{% static "/js/app.bc1afe162faeb2a6bfa3.js" %}"></script>
</body>
</html>
Related
Html File
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
<link rel="stylesheet" type="text/css" href="{% static "css/style.css" %}"/>
</head>
<body>
<h1>This is from index.html</h1>
{{help_me}}
<img src="{% static "images/DjangoGuitar.jpg" %}" alt="sorry text not loaded">
</body>
</html>
CSS file
h1{
color: red;
}
Output:
This is from index.html
Welcome to the page sorry text not loaded
Have you tried enclosing the css/style.css part in single quotes to see if it works? Like so <link href="{% static 'css/style.css' %}" rel="stylesheet">.
The double quotes at "css/style mean you have closed the first one beginning at href="{%
How To use the audio file of the local system to play in django?
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<link href="{% static 'css/result_style.css' %}" type="text/css"
rel="stylesheet"/>
<link rel="stylesheet"href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div class="container" align="center"><br><br><br>
{% load custom_filters %}
<h2>{{summary}}</h2>
<br>
This part is working fine while playing this part in simple html code
<p>Click on the audio To Listen Your Summary</p>
<audio controls>
<source src="D:\textanalysis\audio_file.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<div>
</body>
</html>
I import a bootstrap template in django, the index.html is:
{% load staticfiles %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Business Casual - Start Bootstrap Theme</title>
<!-- Bootstrap Core CSS -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom CSS -->
<link href="{% static 'css/business-casual.css' %}" rel="stylesheet">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<div class="brand">university search</div>
<div class="address-bar">3481 Melrose Place | Beverly Hills, CA 90210 | 123.456.7890</div>
...
All my staticfiles in the folder static , the setting.py file is:
STATIC_URL = '/static/'
I want to modifie the image of bacground of template but doesn't work , the css file is :
body {
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
background: url('/home/hadoop/PROJET/static/img/theboatthatrocked.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cov
but it does not change anything, you can help me
You can try it with this tutorial:Config static files in Django projects
I'm trying to implement my 404.html page into my django project, and coming across this error. Everything else is complete in my project, so I'm eager to get this last piece done! any help is greatly appreciated. included the 404.html and head_css.html file. please let me know if you need to see anything else.
Can anyone help with this?
My 404.html code:
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="404 Page not found">
<meta content="width=device-width, initial-scale=1, user-scalable=no" name="viewport">
<title>Codes For Anyone</title>
<link rel="shortcut icon" type="image/x-icon" href="{% static 'themes/images/favicon.ico' %}">
<!-- Google icon -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
{% include 'landing/head_css.html' %}
</head>
<body class="body-custom body-404page">
<div class="errorpage">
<div class="wrapper">
<div class="container">
<div class="content-primary">
<h1 class="title">Page Not Found</h1>
<p class="description">The page you are looking for was moved, removed, <br>
renamed or might never existed.</p>
<div class="section-footer">
Back To Homepage
Report Error
</div>
</div><!-- content-primary -->
</div><!-- container -->
</div>
</div>
<!-- chitika ad code -->
<div class=" container-fluid full-width-container contact">
<script type="text/javascript">
( function() {
if (window.CHITIKA === undefined) { window.CHITIKA = { 'units' : [] }; };
var unit = {"calltype":"async[2]","publisher":"andrewdiemer","width":550,"height":250,"sid":"Chitika Default"};
var placement_id = window.CHITIKA.units.length;
window.CHITIKA.units.push(unit);
document.write('<div id="chitikaAdBlock-' + placement_id + '"></div>');
}());
</script>
<script type="text/javascript" src="//cdn.chitika.net/getads.js" async></script>
</div>
<!-- end ad code -->
</div>
<!-- Scripts Starts -->
{% include 'landing/javascript.html' %}
<script>
$(document).ready(function() {
var sPath=window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
$(".pmd-sidebar-nav").each(function(){
$(this).find("a[href='"+sPage+"']").parents(".dropdown").addClass("open");
$(this).find("a[href='"+sPage+"']").parents(".dropdown").find('.dropdown-menu').css("display", "block");
$(this).find("a[href='"+sPage+"']").parents(".dropdown").find('a.dropdown-toggle').addClass("active");
$(this).find("a[href='"+sPage+"']").addClass("active");
});
});
</script>
<!-- Scripts Ends -->
</body>
</html>
head_css.html:
{% load staticfiles %}
<!-- Bootstrap css -->
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/bootstrap.min.css' %}">
<!-- Propeller css -->
<!-- build:[href] assets/css/ -->
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/propeller.min.css' %}">
<!-- /build -->
<!-- Propeller date time picker css-->
<link rel="stylesheet" type="text/css" href="{% static 'components/datetimepicker/css/bootstrap-datetimepicker.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'components/datetimepicker/css/pmd-datetimepicker.css' %}" />
<!-- Propeller theme css-->
<link rel="stylesheet" type="text/css" href="{% static 'themes/css/propeller-theme.css' %}" />
<!-- Propeller admin theme css-->
<link rel="stylesheet" type="text/css" href="{% static 'themes/css/propeller-admin.css' %}">
I am working with a django template. the head of the template is:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Landing Page - Start Bootstrap Theme</title>
<!-- Bootstrap Core CSS -->
{% load staticfiles %}
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<!-- Custom CSS -->
<link href="{% static "css/landing-page.css" %}" rel="stylesheet">
<!-- Custom Fonts -->
<link href="{% static "font-awesome-4.2.0/css/font-awesome.min.css" %}" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
My view contains:
def index(request):
t = loader.get_template('app1/index.html')
c = RequestContext(request, {})
return HttpResponse(t.render(c),content_type="application/xhtml+xml")
How can I fix the error in the screenshot?
This is not a valid XML tag:
<link href="{% static "css/landing-page.css" %}" rel="stylesheet">
Instead, it should be:
<link href="{% static "css/landing-page.css" %}" rel="stylesheet" />
This is because, according to XML specs, any tag has to be either closed with its pair or self-closed by including slash (/) at the and of opening tag.
Most browsers understand this, but, speaking strictly, this is incorrect.
Also, if you have any <hr>, <br> or similar single tags, you'll have to fix them all as well, i.e. <hr />, <br />
See this list: http://xahlee.info/js/html5_non-closing_tag.html.