Do static websites store cookies? - cookies

I am developing a static website and I will deploy it using a hosting service.
I am wondering whether the website will store cookies once deployed (perhaps set by the hosting service), and if and how I should ask users for permission since I have no backend but only frond-end html/css pages.

If there is only HTML and CSS then it stores no cookies. But if you have some javascript code in your website then you can use javascript to store cookies for remembering things. But for a simple HTML and CSS website cookies have no benefit to you and you can't access them.

Related

Displaying data retrieved through GraphQL in a Django website

(Disclaimer : I'm just getting started with Django, and with web dev in general)
I have a backend app that stores different kinds of resources. Some are public and some are private. The application is accessible only to identified users. A GraphQL API allows me to access the resources.
On another server, I'd like to create a website that will be accessible to everyone. I want to use Django to create it.
The website will display a list of resources tagged as "public" in the backend app, with a pagination system and, say, 20 resources by page. The CSS will differ from the backend app and there will be a search section.
From what I understand, I should be able to retrieve the data through the GraphQL API, but I'm a bit confused here. All the documentation and tutos I can find about Django and GraphQL seem to be about setting up a GraphQL API server with Django. All I want to do is to build custom queries and to display them on my different html pages.
How can I do that? Where should I start?
You should connect your project with a GraphQL client. As per my research, I have found that there are implementations and examples for graphene-mongoengine in Flask (Flask has a direct GraphQL client).
Mongoengine Flask with GraphQL Tutorial
For Django you can check this out
Edit- I was able to get the data from my database with python-graphql-client. Now I am able to display them in my template.
Let me know if this helps

In Squarespace Developer Mode, can one save the AWS CLI SDK to the website's server-side "Home" directory? If so, how?

The Current Situation
My Squarespace website uses client-side, custom JavaScript and JQuery injected into the Head section of a page as well as the Amazon Web Services Command Line Interface SDK. The custom JS, the JQuery and JS Libraries, and the SDK are loaded into the page Head each time the page is loaded.
That Is Objectionable
The SDK uses two predetermined, static, handshake credentials to connect to the AWS server. They are stored in a file, "credentials," in a hidden directory, .aws, created by the SDK when it first loads. At that point, however, they have no values.
The Situation Exposes Supposedly Secret AWS Login Credentials To A Potential Hack
Currently, it is necessary to set their values programmatically when the page loads by executing a CLI "updateConfig" command in the custom JS. The credential values are thus in a plain-text config file client-side.
As such, they are not so secret. Any site visitor who loads the page in his browser could use the browser's developer tools to view the source code and, potentially, discover the supposedly secret credentials thus compromising the security of the AWS account.
One Ought Not Put The Secret Credentials In Client-side JS
For that reason, AWS rather forcefully insists that one not put the credentials in client-side source code. The preferred method is to instantiate the SDK on the server-side and set the credentials one time only. Thereafter, the hidden .aws directory and the credentials file persist server-side at the root level of the website's Home Directory.
The Problem
So the problem is to load the SDK in the server-side Home Directory where it will persist over the site's lifetime.
The Question
The question is on a Squarespace website can one load the SDK server-side at the root level on the site's Home Directory. Can it be done in Developer Mode? How?
Unfortunately, Squarespace doesn't support the use of server-side/back-end code:
You can't add server-side code. Server-side code is handled by a server, not by a browser, and includes:
- PHP
- Ruby
- Ruby on Rails
- SQL
That would also include server-side JavaScript/Node. Because Squarespace only supports the front-end addition of HTML, CSS and Javascript within Code Injection, Code Blocks, and Developer Mode, you need to use front-end JavaScript in order to utilize third-party APIs (which is what you're doing currently).
Enabling Developer Mode only exposes template files for the site. Beyond the JSON-T templating engine, Developer Mode doesn't enable any sort of server-side logic or requests to take place. Therefore, it seems the answer to your question is no.
A potential alternative solution may be to use Google Apps Script or Google Cloud Functions instead, storing the credentials in the code there, and making a front-end request (via JavaScript on your website) to that endpoint in order to perform the handshake and get back the data you need.

Hosting HTML+CSS+JS websites with Django rest framework backend

My backend APIs are hosted on Django rest framework and the for the frontend I have purchased a theme which is on HTML, CSS, Bootstrap, and Javascript, I wanted to know what would be the best practice to host this website in production, should I have two servers one for handling the static website and other for the backend or shall I integrate this with the backend. The theme is quite vast and would like to go with the first option, so I go with the first option then where should I host the website, and does it impact the performance?
I have already researched but could not find what would be the best practice in this situation, Let me know if any other details are required.
If you're use API and frontend template, you don't necessarily need to host them on separate servers. You can do that on one server. It's just a matter of API calls

How to shared open cart session in multiple domains

I have a Moodle website and an Opencart website, I want to share Opencart session data with the Moodle website.
How would I do this?
See if you're going to use session for two different websites and I am assuming these both websites are deployed on different servers then do checkout Redis for the same. You can go through this article on Redis Session Management. It is better than Database or File storage and you can scale up easily in case of large traffics.

Can a Django project be hosted in Firebase? If yes, give me an idea

I know to host my Django projects in pythonanywhere or something else. But, I need to know is that possible to host a Django project in Firebase Hosting Services.
Firebase Hosting only supports static content. It does not give you a way to run any backend code. You can use Firebase Hosting to proxy some requests to a Cloud Functions backend, but Cloud Functions provides its own way of handling HTTP requests.