I have this piece of code that is working fine on my PC environment (virtual environment) but causing problems in a ubuntu, Nginx server. It is a digital ocean droplet actually. I am not very much familiar with ubuntu that's why I am unable to understand the cause of the problem.
Now the problem is, that the 'checkout.html' template doesn't render the value of 'fire'. I have tried to troubleshoot manually and in the 'inspect' window I only see an empty label.
Why is this happening, is it because of the django=2.2.3 version or ubuntu or Nginx or am I missing anything here?
Note: I am updating the files through Filezilla.
Kindly help, please.
Views.py
def checkout(request):
return render(request, 'checkout.html', {'fire':"fire"})
checkout.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<label>{{fire}}</label>
</body>
</html>
urls.py
from .views import *
path('checkout-page', checkout, name="checkout"),
Related
I'm trying to connect Google One Tap Login with Django framework, but I'm having issue.
I'm not sure why this is displaying an issue. I followed all of the guidelines described in the Google documentation.
issue -
The given origin is not allowed for the given client ID
Here is my Google API client configuration for the javascript origin url.
Here is the login html template code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Hi Reddit</h1>
<script src="https://accounts.google.com/gsi/client" async defer></script>
<div id="g_id_onload" data-client_id="i don't want to shere"
data-context="signin" data-ux_mode="popup" data-login_uri="http://localhost:8000/google/login/"
data-auto_select="true" data-itp_support="true">
</div>
<div class="g_id_signin" data-type="standard" data-shape="pill" data-theme="outline" data-text="continue_with"
data-size="large" data-logo_alignment="left">
</div>
</body>
</html>
I'm not sure why this is displaying an issue.
Is it possible to load Google One Tap Javascript in Django?
What should I do to load Google One Tap Javascript in Django?
I am trying to run an ExtJS 7 app using and django 3 as backend.
The same index.html created by sencha cmd loads and runs as expected.
But loading it with django backend it does not load and gives an error (described below).
I guesss it is related to csrf token.
index.html:
{% load static %}
<!DOCTYPE HTML>
<html manifest="">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=yes">
<title>front</title>
<!-- The line below must be kept intact for Sencha Cmd to build your application -->
<script id="microloader"
data-app="eef86001-0c1f-47f8-bad2-962464cb0916"
type="text/javascript" src="{%static "bootstrap.js" %}" >
</script>
</head>
<body>
</body>
</html
Error in chrome:
bootstrap.js:868 GET http://127.0.0.1:8000/index/bootstrap.json?_dc=1576345210630 404 (Not Found)
VM52:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at new Manifest (bootstrap.js:1949)
at Object.setManifest (bootstrap.js:2161)
at bootstrap.js:2141
at XMLHttpRequest.readyStateChange (bootstrap.js:854)
Thank you all for any help
Koby Peleg Hen
I'm running an ember-cli app. The Inspector (Chrome) says This webpage is not running Ember.js.
Looking at the source view on the browser, it includes
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
...
<script src="/ember-cli-live-reload.js" type="text/javascript"></script>
How can I get the Inspector to recognize it?
I stumbled onto a solution. I happened to right-click on the page's source-view, and "Inspect" came up, so I chose it. Inspector now recognizes the page as ember.js.
Ideally, I want my index.html from this:
<!-- app/index.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Program With Erik Blog Example</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{content-for 'head'}}
<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/example1.css">
{{content-for 'head-footer'}}
</head>
<body>
{{content-for 'body'}}
<script src="assets/vendor.js"></script>
<script src="assets/example1.js"></script>
{{content-for 'body-footer'}}
</body>
</html>
into production code. But for some strange reason, each time I call ember build, I do not get the expected production-looking code. Instead I get something like this
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to Firebase Hosting</title>
.
.
.
<!-- lots of code -->
It's the default firebase page!
What is happening? I've deleted the picture multiple times. But each time I call ember build it builds the firebase default page rather than my ember app index.html.
I'm new to ember and I've been fiddling around heavily with the config/environment.js and the firebase.js. Any thoughts on why this might be happening?
On initialising a firebase app, one is prompted:
? What do you want to use as your public directory? (public)
make sure to set the dist folder as the public directory, that is
? What do you want to use as your public directory? (public) dist
using the default public will cause the above behavior no matter how many times you build your Ember app.
To fix the problem, re-initialise the firebase app with the firebase init command, and set the right folder as the public directory.
I've executed the following command to build ember for production environment. However when I opened the dist folder, clicked the index.html it returned a blank page. compared to as when I run ember server.
The command I've used to generate the dist folder
ember build --environment production
Here's how I do it dist folder -> click the index.html.
Here's the result.
Here's the contents of the index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>TodoMvc</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/" />
<meta name="todo-mvc/config/environment" content="%7B%22modulePrefix%22%3A%22todo-mvc%22%2C%22environment%22%3A%22development%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22todo-mvc%22%2C%22version%22%3A%220.0.0+8f1032d8%22%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%20%27unsafe-eval%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D" />
<script src="/ember-cli-live-reload.js" type="text/javascript"></script>
<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/todo-mvc.css">
</head>
<body>
<script src="assets/vendor.js"></script>
<script src="assets/todo-mvc.js"></script>
</body>
</html>
Here's the error message
I was doing it the wrong way. I deployed the app to an http web server. turns out by clicking the index.html. I'm accessing it via the file protocol