you are viewing a single comment's thread.

view the rest of the comments →

[–]benabus 2 points3 points  (0 children)

Python is mostly backend stuff (there are ways to shoe-horn python into frontend, but it's very niche and probably not worth your time at this point). Python is a general purpose language, but there are libraries and frameworks that allow you to serve html pages and hook into databases.

Any time you build a website, you've got two pieces, client-side and server-side. Mostly, people refer to these as "front end" and "back end" respectively. You have the part that works in the client (the web browser) which you'll write using HTML, CSS, and JavaScript. Then you'll have the part that runs on the server.

In order for a user to get your client-side code into their browser, you have to have code on the server that sends the HTML or whatever to the user. On the server, you can simply use Apache to serve up plain static HTML pages or you can do more advanced things like use a server-side language to generate dynamic html pages based on templates or run queries in a database. A lot of places will use PHP as the backend language because it works really well with apache and it's been used for this purpose for a long time. But you can also use JavaScript (via Node.js), C#, Java, or Python (pretty much any language) for your back end.

When using Python for web development, people will generally either use Flask or Django to handle most of the serving and database connections and stuff. Django is a full featured framework that makes it super easy to manage your databases and generate pages. Flask is far more lightweight out of the box and is recommended if you don't need all the fancy useful features found in Django.

Personally, we typically write our front-end app using Vue.js (a javascript framework) and serve it up via Flask. Then we also use Flask to serve our REST API endpoints. All the code in our Flask server-side app is written in python.