5 ms·
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
by jszymborski 7y ago
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.
- appleiigs 7y agoWhere 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.
- acdanger 7y agoI have a Flask app deployed on PythonAnywhere that's using sqlite. Not nearly as streamlined as Heroku, but I'm happy with it.
- scwoodal 7y agoIf 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/ http://dokku.viewdocs.io/dokku/
- 52-6F-62 7y agoI’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.
- nwsm 7y agoI take that to mean you are hosting your db locally with the app server? Hardly seems like Heroku is in the wrong there
- appleiigs 7y agoyes, 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
- ryry 7y agoDepending 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).
- raihansaputra 7y agoI 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.
- whalesalad 7y agoSame 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.
- smacktoward 7y agoSay what you want to about PHP, but when it comes to deployment it’s hard to beat.
- jszymborski 7y agoYah, 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
- no_wizard 7y agoI 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).
- meowface 7y agoOnly for web apps that don't get much traffic. Constant hand-tuning of PHP-FPM configs isn't fun.
- whalesalad 7y agoTechnically the exact same setup can be had with Apache and mod_python. You don’t need WSGI to do python apps.
- airstrike 7y agoI'm mostly fine with Amazon EC2 with uwsgi in emperor mode / nginx / psql
- nine_k 7y agoWhy, 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.
- nwsm 7y ago>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
- zaptheimpaler 7y agoDocker 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
- no_wizard 7y agoThis 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/ https://docs.docker.com/machine/get-started/
- crispinb 7y agoAnd 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.
- rgblambda 7y agoNot with Home edition, though you'd be ill advised to use that in a production server
- asplake 7y agoAWS 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.
- mojoe 7y agoYou can very easily deploy WSGI-compatible apps to AWS Lambda in seconds with the open-source library Zappa (https://github.com/Miserlou/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/ https://compellingpython.com/