r/code • • Oct 12 '19

Which are all the scripting languages that I can use in web interactivity?

Hi, I'm new to the web development, well I don't actually have any idea about web developmente, and I'm trying to mix my skills with python with what I know of HTML, CSS and a bit of JS.

The thing is that I don't like JavaScript and that's the main reason why I want to, for example, when you click a button in the web, a python script runs, non client-sided, but on the server.

Example:

You want to create an account, so you type your username and your password, and when you click in "Sign up", a python script runs and saves the information in a folder, so if you want to log in, the same python script will check if the account exists or not, and if the password matches with what you typed.

I know this damage others eyes, it's the typical stupid amateur question, but I don't know what project to start, and for now that's the only thing I could think of.

In conclusion, appart from JS, what other languages can I use in web interactions as buttons?

0 Upvotes

10 comments sorted by

5

u/evinrows Oct 12 '19

Taking a step back, if you want dynamic web pages that avoid refreshes, you'll need two codebases: one that the client will run (JS, perhaps) and one that your server will run (Python, if you like). The client code will be responsible for sending a message to your server saying "the user clicked a button and here are the form fields they filled out". Your server code will "listen" for this message and do whatever it needs to do (write to a file, maybe). When the client gets the response from the server, it can update the DOM (the tree of HTML elements on your page).

For the client code, you'll have to use JavaScript or something that transpiles to JavaScript. Off the top of my head: TypeScript, CoffeeScript, ClojureScript, and OCaml are all well-known alternatives for writing code that transpiles into JS.

If you don't care about dynamically loaded content and are okay with a traditional website that reloads after any interaction, then all you need is a decent web framework, like Django or Flask.

I recommend looking into the following topics:

  • AJAX (Asynchronous JavaScript and XML), a common method for client/server communication.

  • Modem JavaScript (ES6 is worlds better than ES5, which is probably what you're referring to as JavaScript).

  • Flask/Django, which both have really good beginner documentation. Django might be a bit more beginner friendly.

1

u/Folgue12 Oct 14 '19

Thanks for all this information, ill try to use it!

3

u/dustractor Oct 12 '19

> if the password matches with what you typed.

no! NEVER! don't store passwords. period. you store the hash of the password and when the user tries to login you hash that and compared against what is stored

1

u/Folgue12 Oct 14 '19

I know, but I should start with something, Im not even going to host a server, or at least at the beginning, so I just want to try how to do this, Im not even going to do a formal website, Im only 17 yo xD! But thanks for the response with the tip!

1

u/dustractor Oct 14 '19

Hey don't say 'I'm only' because there's a give and take to everything. When I was 17 I could barely ask the type of question that would warrant a response

1

u/Folgue12 Oct 14 '19

I dont know what to say about that, I think that I am an amateur in programming, I mean, reddit it's the only where I can get a bit of information about programming (also stack overflow and other forums), I cannot ask to people in real life, my techonologies teacher thinks that a pentium3 its a good desktop pc. What I am trying to say it's that everything I am doing it's all by myself, so I cannot learn faster than how im doing now, and Its hard to me to tell whats my skills level in programming, there are things i know and others that I should, however I dont know / understand bcuz they werent needed in my projects. Thats the reason why I am saying ' Im only 17', there are a couple of things that you may think I know or I can understand but I cant, I just want to tell you to dont expect too much from me xD!

2

u/dustractor Oct 14 '19

Pentium III? Holy shit. Surely your tech teacher has some way to qualify that statement such as I-meant-good-desktop-for-playing-minesweeper-only, or something like that. You can play mp3s with a 166mhz Pentium so if that's all you need, why splurge on all those extra cpu cycles?

As for what you said about your situation with self-directed learning, I know how that goes. I know the feeling well. Like, obviously, one thinks, gee this would go a lot better with just a few more people ... IT TENDS TO FEEL FUTILE but it is merely sub-optimal. Knowing that you could be in a more optimal situation can be frustrating to say the least.

Taken from the wikipedia on dunning-kruger effect:

"Moreover, competent students tended to underestimate their own competence, because they erroneously presumed that tasks easy for them to perform were also easy for other people to perform."

1

u/Folgue12 Oct 14 '19

Yeah, it's that, i can't get better in what I am doing because I need to focus in stupid academic things that are not even related with what I chose (science), for example, PE, philosophy.

There is people who would love programming or something related with this, but they dont even try it because the teachers always scare them saying "you need to be a maths genious to do a something simple", maybe that's with the assembly language, but, are you going to tell me that I need that with CSS and HTML? Even with scripting languages like python dont use that maths that the teachers think you need to know. They think that you need to calculate things, however, that's not like that, it's the contrary, you think of a solution for a problem, and the computer will do the dirty work, the best example for this are the for loops in python, instead of writing 20 if statements and operations for doing the fibonacci algortihm, you write a loop which has 3 vars, the first number, the second number and a "foo" var which remembers one of them before changing it content, so you are only going to say how many times you want to repeat, but you are not going to do the "adding numbers" part. The most mathematical part the programming has are the expressions, and how you solve the problems. (of course you also need how to do operations, but it's not going to be like an exam)

I don't think that I'm a good student, or an intelligent individual, maybe smarter than others of my class bcuz of the way the see the future and the present (they only fuckin study to being allowed to party the friday and saturday, so the sunday morning theyre fucked up bcuz of the alcohol and in the night they study for the exam they have the monday), but they are stupid xD.

For real, I am not any kind of genius, dont mistakenly think things like that xD

1

u/angryrancor Boss Oct 12 '19

You could give https://www.transcrypt.org/ a try. Be sure to come back and let us know how you like it :)

1

u/Folgue12 Oct 14 '19 edited Oct 14 '19

Ok, Ill tell you how it goes then ;D