pythonofftopic | Unsorted

Telegram-канал pythonofftopic - Offtopic

12466

Offtopic group for casual talking about anything. @rules_for_python still apply (except for the ontopic rule)

Subscribe to a channel

Offtopic

well, I recommend use pnpm to manage dependencies, but I can't help you on integrating python with js, never did that yet, to learn more of pnpm go to its site:

https://pnpm.io/

start a new project with pnpm, because diference between pnpm and npm can cause problems...

some videos to start with pnpm:

PNPM basics:
https://www.youtube.com/watch?v=mZxAv0bpMWI

PNPM config for beginers:
https://www.youtube.com/watch?v=hH4e8PJaFeg

and i recomend to use nvm or fnm to manage your node versions (if not use bun or deno):

https://www.fnmnode.com/

I prefered FNM...

or

https://www.nvmnode.com/

that's it, it's all that i can do for you...

Читать полностью…

Offtopic

npm, pnpm and yarn are like pip in python...

bun, deno are like node but with ts integrated and some more features...

Читать полностью…

Offtopic

don't use npm instead use pnpm...

and maybe you wanna use biome in place of eslint...

Читать полностью…

Offtopic

but those are unwanted files when i just want warning over not using funciton, wrong naming and so on in js , but pylance offer this so easily no new file needs in my repo, but for js they say me to run this,
npm init @eslint/config@latest
and as a result i got many many files 😨, as i dont know those files do actually what or maybe make my code slower in real hosting, so i fear to use those files, and also i want to use js type sugession and so on 😅

Читать полностью…

Offtopic

its so problamatic, actually i still not undersand the npm and the lot of files coming in my repo so scary to see and undersatnd those files in the /node_modules, is this like the python libraries but just need for eslint?

Читать полностью…

Offtopic

i think not to use js

Читать полностью…

Offtopic

Not sure what do you mean by js structer btw

Читать полностью…

Offtopic

i wanted to get sugession in my .js files as i am doing in flask but the real js code need to be done in js structer, so i wish i only want like pylance's error for my js but i found when i try to do setup the eslint, it say https://eslint.org/docs/latest/use/getting-started#quick-start

and form here i foudn in my repo there just making the package.json, ... node_modules are also creating in my python repo, is this really ok there in my flask code?

Читать полностью…

Offtopic

Is anyone here JavaScript Developer ???

Since I realized I need to use JavaScript anyway, I am currently using VS Code. However, I am not receiving proper warnings when writing JS code, likely because the HTML elements are not recognized, even though the code itself does not show any errors. This is different from Python, where Pylance in strict mode provides clear warnings.

What extensions do you recommend for .js files to get similar functionality? As I am completely new to JavaScript, I would like to start with the best tools from the beginning. Any suggestions?

What i found by my research is this: EsLint -> but i am not getting why it say after install the extension i need to do some global, local setup even i am using python, so why i will do local setup of using npm here i am confused or is this standard to use?

Читать полностью…

Offtopic

I just scrapped $80 worth of content :)

Читать полностью…

Offtopic

https://flask-wtf.readthedocs.io/en/0.15.x/csrf/#javascript-requests

Читать полностью…

Offtopic

how did u get graphics card in this economy

Читать полностью…

Offtopic

Still, it's better to add an exception :)

Читать полностью…

Offtopic

oooh...can you just add an exception?

Читать полностью…

Offtopic

right now I'm trying to disable or remove this anti malware thing in windows 11 somehow, but it keeps turning itself back on.

Читать полностью…

Offtopic

When installing packages like Bootstrap 5 and HTMX, do I need to use npm, pnpm, or yarn? Currently, I download the raw .js and .css files directly. Is it okay to install these in my repository using pnpm, or should I continue with my current approach? If I switch to pnpm, what basic concepts do I need to learn to manage dependencies effectively?

Читать полностью…

Offtopic

i even don't know about npm and what those files are doig and again, pnmp, bun yarn all i will got cracked one day

Читать полностью…

Offtopic

Install it globally, don't use init.

Читать полностью…

Offtopic

I don't get how people get scared by files 🤷

Читать полностью…

Offtopic

Just because you don't want some files?

Читать полностью…

Offtopic

yes so i am confused as in my github repo the js thigns will also got uploded even those not need for my python app.

Читать полностью…

Offtopic

If you want js tooling somewhere will need to be referenced right?

Читать полностью…

Offtopic

What it has to do EsLint with python? Just setup EsLint in your computer so the extension can use it

Читать полностью…

Offtopic

what did u even scraped

Читать полностью…

Offtopic

Thanks for this btw, i though i need to do something like this, but i missed this part 😅 💚

For me in this case, in the js funciton i just add this:

var csrfToken = document.querySelector(
'meta[name="csrf-token"]'
).content;

and then in header i add csrfToken and all got solved 😀

Читать полностью…

Offtopic

Hello, I was using the Flask-WTF library and have the following code in my head:

<meta name="csrf-token" content="{{ csrf_token() }}">


However, I found that when client-side JavaScript makes a request, the CSRF token gives me an error. As far as I have researched, when JavaScript performs a POST request to my endpoint, the CSRF token value is not being sent to my Flask application. How can I fix this?
My js looks like this:-

async function fetchRights(contentId, options) {
var response = await root.fetch((options && options.rightsUrl) || RIGHTS_URL, {
method: "POST",
headers: { Accept: "application/json", "Content-Type": "application/json" },
body: JSON.stringify({
content_params: { content_id: contentId, content_type: CONTENT_TYPE }
}),
signal: options && options.signal
});

I maybe thinking my js has the probme not the flask_wtf library, what do you anyone know this

Even i found my routes function not executes anyway it just directly returns the 400 error, any sugession where to look upon

Читать полностью…

Offtopic

what are you cooking !

Читать полностью…

Offtopic

I disabled it again and this time it worked somehow

Читать полностью…

Offtopic

it keeps deleting my files

Читать полностью…

Offtopic

agreed, everytime I sleep late my day is ruined

Читать полностью…
Subscribe to a channel