Return to

Should I program in python for my web app?

I would like to learn python for web development and was researching the django framework. I plan to code a YouTube like website. Front end for uploading and viewing/playing videos. Back end to accept the video and encode using ffmpeg. I havent decided whether to use a saas like cloudflare streaming service or program the encoding process.

Can python handle this type of application or should I stick with a LAMP stack and use a php framework like laravel?

I would like to learn python

Can python handle this type of application

Yes, and yes.

Working on a project that you’re motivated to do is a great way to learn new languages. Arguably the best way.

Both PHP and Python can handle this, but Python is a bit more common in purpose-specific application development. If you’re building skills that are suitable for employment, you’ll find that demand for Python is stronger than PHP these days.

If you want something that’s generic and “pretty much runs everywhere”, PHP is a popular option. The fact that you can just drop the files in and run with it is both the biggest strength of PHP, and it’s biggest weakness.

Deploying Python apps is generally a bit harder, requiring a little of knowledge reverse proxies for production deployment. But it’s only hard in comparison, skimming a “Python production deployment best practices” article will point you in the right direction.

should I stick with a LAMP stack

Nginx is a bit more popular in Python-land than Apache httpd because of the superior reverse proxy functionality. It’s also suitable for PHP applications that don’t rely on .htaccess functionality (.htaccess is terrible, you really shouldn’t be using it on Apache either, but many PHP apps rely on it.)


Also, arguably more important, more fun to learn with this type of application :wink:

Personal preference, obvs.

Python is more versatile for sure. IMO it’s near the time PHP should die in a fire, it basically became dynamically typed and crappier C# these days, but still does it’s job well. Python is definitely more fun, can put it in all sorts of places, and even if you don’t want it in the long term, it’s an amazing upgrade to shell scripting when you need it.

1 Like

[E]ven if you don’t want it in the long term, it’s an amazing upgrade to shell scripting when you need it.

And if you’re deploying webapps (self-hosted or professionally), you’re bound to bump into Ansible at some point.

1 Like

You don’t really need nginx or apache or anything really with python.

You will need some python libraries.

The best way IMO to run python projects is using venv to create a python virtual environment in a single directory, and install the libraries you require within it.

In terms of code , depending on a particular http framework, you’d have some functions or methods that you’d register that the framework would call when a user hits a particular url.
When your .py server starts, it’d initialize whatever you think you’ll need and the framework would start listening on a port for http requests and usually it would include a router that would dispatch the requests to your code based on those urls.

Instead of Django (which is more than a bit of a kitchen sink) you may want to start with something simpler like Quart (similar to old python flask framework), and mako for templating. (if not quart, maybe tornado?)