Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


>Yes, even on Windows.

This would require you to run your containers on Windows servers right? Not much reason to do that anymore.

Instead should just containerize as part of deployment pipeline


Sometimes all you have is a Windows box. You can either run Linux in a VM on it, or use WSL, or run native Windows containers which are a thing. Imagine that you have a binary dependency which is Windows-specific.


Docker on Windows can run linux containers just the same as docker on linux.. it uses a virtualbox vm with linux and runs containers inside that


This is not the case. It uses Hyper-V (which is multitudes faster in every benchmark I’ve seen and much more stable)

https://docs.docker.com/machine/get-started/


And WSL2 takes it a stage further, running linux-native docker on a linux kernel (albeit wsl2 is itself running in a specialised Hyper-V machine).

I haven't used Docker with WSL2 yet, but in other uses I've found WSL2 extremely fast. As long as you stay within its vhd, file access is ext4-quick. And on my machine running the geekbench cli gave me almost identical results to a native linux install.


Not with Home edition, though you'd be ill advised to use that in a production server


If you are using azure. Container service is very good, at least small scale projects.


or you can run on google app engine seamlessly.


I'm mostly fine with Amazon EC2 with uwsgi in emperor mode / nginx / psql


You can very easily deploy WSGI-compatible apps to AWS Lambda in seconds with the open-source library Zappa (https://github.com/Miserlou/Zappa). Zero server maintenance and zero cost if nobody is using your apps (I put up personal apps all the time with this paradigm, it's great). I love it so much I wrote a book about it: https://compellingpython.com/


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.


I just looked at this myself yesterday and Heroku offers free postgresql instance for under 10K rows. And decided to skip S3-like solutions by embedding my compressed image to the DB[0]. Want 10k-10M rows? That's $9 a month. A bit steep, but easier than configuring DO instances.

[0]: I know this is not best practice, but this is a small project and this is a hack that I fully know the tradeoffs for.


Depending on what you need and your traffic, a simple $5 Digital Ocean droplet with a nginx reverse proxy in front of Django would do the trick. It'd still let you run sqlite, but Django's pretty powerful when you give it postgres (which you could also run in the droplet).


I have a Flask app deployed on PythonAnywhere that's using sqlite. Not nearly as streamlined as Heroku, but I'm happy with it.


I take that to mean you are hosting your db locally with the app server?

Hardly seems like Heroku is in the wrong there


yes, DB is local on app server. Sqlite is good for my uses. My DB is about 20 MBs. I like to download the sqlite file to my PC to do analysis as the data changes. Postgres seems like overkill and more complicated


AWS Elastic Beanstalk supports Python, and I’ve had a Flask app hosted there for several years now. Two or three easily-fixed gotchas aside, it works great.


Same can be said for any system, regardless of the language.

Unless you’re able to create an artifact like a single executable or a Jar but you still need to supervise those and keep them running.


Say what you want to about PHP, but when it comes to deployment it’s hard to beat.


I have had the opposite experience personally. Any non-trivial application I've deployed has been a lot more complicated with PHP than anything I ever experienced with Python.

Asyncio really makes a difference here. I also hate that PHP has to spin up with every single request. This is something I have never gotten used to (From my understanding, most Python web frameworks just give you a clear/fresh Request Object, which is so much better even with WSGI (unless you're using WSGI scripts) Much easier to maintain application state this way in my experience. PHP-FPM doesn't exactly solve this problem, I don't think).


Yah, I come from a PHP background which is probably why I feel this way about Python... Ruby is likely a similar story since Gunicorn is a fork of Unicorn


Technically the exact same setup can be had with Apache and mod_python. You don’t need WSGI to do python apps.


Only for web apps that don't get much traffic. Constant hand-tuning of PHP-FPM configs isn't fun.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: