Live data from Hacker News

A Beginner’s Introduction to Python Web Frameworks (2018)

stxnext.com

11–20 of 168 posts

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#11

This is a great resource, and there are some neat inclusions like Falcon, but I find the main trouble when building python web apps is deployment. I always feel like I've duct-taped my carefully written app to the web-server.

Why, a Docker container. Yes, even on Windows. Pack up everything into a single image, downloadable from nearly anywhere.

Your web server (which likely also terminates TLS) has to have fastcgi support, you configure the fastcgi and database ports, maybe mount a directory with config files into the container, and that's it.

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#12
I started working with Python around 2013 and I still consider Django the best framework to use. Yes Flask you can pick what you want to use but I have found the supporting libraries to be a bit outdated. Everytime I have used it I feel like I am just gluing together a lot of different pieces and it becomes messy. Django is constantly updated and I have little to no worries about security issues.

Edit: And I have been following new projects such as starlette which I have really enjoyed but I have not bought into the idea of why I need async database access.

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#14

This is a great resource, and there are some neat inclusions like Falcon, but I find the main trouble when building python web apps is deployment. I always feel like I've duct-taped my carefully written app to the web-server.

Where have you deployed? I'm looking to switch for my Django website. I'd like something full-serve like Heroku, but Heroku doesn't work well with sqlite.

If you don't mind a little sysadmin work I've had good experiences with Dokku[1]. I spin up a Digital Ocean droplet or AWS Lightsail instance and it's my own mini Heroku.

It's great for side projects without the limitations of Heroku's free tier. Lots of plugins (Postgres S3 backups, Lets Encrypt certificates) are icing on the cake.

[1] http://dokku.viewdocs.io/dokku/

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#15

Earlier quoted context omitted.

Where have you deployed? I'm looking to switch for my Django website. I'd like something full-serve like Heroku, but Heroku doesn't work well with sqlite.

If you don't mind a little sysadmin work I've had good experiences with Dokku[1]. I spin up a Digital Ocean droplet or AWS Lightsail instance and it's my own mini Heroku. It's great for side projects without the limitations of Heroku's free tier. Lots of plugins (Postgres S3 backups, Lets Encrypt certificates) are icing on the cake. [1] http://dokku.viewdocs.io/dokku/

I’ll second this.

I work on a selection of internal applications and services and we run everything with Dokku. I was skeptical at first because it made initial [legacy code] deployments a bit of a pain, but I’ve been converted. Not sure I’d run everything that way but for small-scale applications it’s a breeze. And because you have to do the sysadmin work yourself it’s a bit more flexible than Heroku.

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#16
post #12

I started working with Python around 2013 and I still consider Django the best framework to use. Yes Flask you can pick what you want to use but I have found the supporting libraries to be a bit outdated. Everytime I have used it I feel like I am just gluing together a lot of different pieces and it becomes messy. Django is constantly updated and I have little to no worries about security issues. Edit: And I have bee…

It's also a myth that Django makes it difficult to pick and choose. For example, this article fails to mention that Django includes support for alternative template engines, including the popular Jinja2. Of course, if you choose not to use a feature like the ORM, you won't get any of the benefits of that feature- but Django doesn't get in your way or make it difficult in any way to do so. You can use as many different ORMs (or no ORM) as you like with Django.

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#17
We need to write a lot of small APIs in Python for SPAs. We ended up going with FastAPI which utilizes Starlette under the hood. I'm surprised neither of them are mentioned here.

Starlette was developed by the same dev who wrote the Django RESTful package. If you mostly just need REST APIs or even GraphQL, it feels far more light and modern than anything in Django and forms some better opinions around things than the usual roll your own stack in flask alternative. Not to mention it's ASGI based instead of WSGI and naturally faster because of it.

FastAPI just builds on that by adding some nice features like minimal dependency injection and really awesome integration with type hints via Pydantic.

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#18
post #12

I started working with Python around 2013 and I still consider Django the best framework to use. Yes Flask you can pick what you want to use but I have found the supporting libraries to be a bit outdated. Everytime I have used it I feel like I am just gluing together a lot of different pieces and it becomes messy. Django is constantly updated and I have little to no worries about security issues. Edit: And I have bee…

Thanks for pointing to Starlette, I didn't know it and it looks interesting.

I completely agree with you on Django. I've had the chance to implement an e-commerce solution in Flask and another one in Django and the process has been a lot easier and faster with Django. You just can't beat having all the basic tools bundled and configured, along with one central documentation.

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#19
The post doesn't mention Django's migration system, which is a killer feature. Of course, one should change their database infrequently and deliberately, but it is nonetheless a delight to use, and a feature that is not matched by many other web frameworks, Python-based or otherwise.

Re: A Beginner’s Introduction to Python Web Frameworks (2018)

#20
post #12

I started working with Python around 2013 and I still consider Django the best framework to use. Yes Flask you can pick what you want to use but I have found the supporting libraries to be a bit outdated. Everytime I have used it I feel like I am just gluing together a lot of different pieces and it becomes messy. Django is constantly updated and I have little to no worries about security issues. Edit: And I have bee…

It's also a myth that Django makes it difficult to pick and choose. For example, this article fails to mention that Django includes support for alternative template engines, including the popular Jinja2. Of course, if you choose not to use a feature like the ORM, you won't get any of the benefits of that feature- but Django doesn't get in your way or make it difficult in any way to do so. You can use as many differen…

Everything you wrote is true, however I think using another ORM in Django is asking for trouble, or at least it's missing a lot of the benefit of Django. The way models work with admin, forms, etc is to me what makes Django so efficient. Also, you don't get much by switching Django templates to Jinja.
Post reply on HN