News for hackers. Stuff that matters.
Re:Ask HN: Fastest/easiest framework to build a web applicat... by franga2000 on Monday January 27, 2020 @04:04PM (#22163760)
Django. Nothing has ever surpassed Django for me. It is soooo much faster to prototype with than anything I've ever used (especially when you know all the amazing shortcuts, but that's not a requirement as their docs are incredibly good).

It can do anything you could possibly want to do with a standard web app and if you really want to do crazy Javascript things you can always just use it as an extremely powerful backend for whatever the frontend framework of the day is. The admin site alone has saved me weeks of work and I keep finding amazing features in it that often just seem like magic (formsets!!).

Re:Ask HN: Fastest/easiest framework to build a web applicat... by Zivanovicb on Tuesday January 28, 2020 @07:59AM (#22168911)
How do you feel about implementing social authentication with Django Rest Framework? What are the packages you'd normally use?
Re:Ask HN: Fastest/easiest framework to build a web applicat... by franga2000 on Tuesday January 28, 2020 @10:58AM (#22170518)
I just lost the whole explanation I was about to send because Android is really stupid sometimes, so here's the short version:

Most social auth uses OAuth2, which doesn't exactly make sense with REST, but you can still use it alongside a REST-based app.

I see 4 scenarios:

1. A JS web app that uses SessionAuthentication can just use python-social-auth's Django app directly. Since the session is shared, it should Just Work™.

2. A JS web app that uses tokens: django-rest-framework-social-oauth2 seems to be made for this, but you could also do it with plain python-social-auth (which the former uses internally) by generating a token on your /success URL and sticking it into localStorage.

3. A non-web app that uses tokens: like number 2, but in a WebView.

4. A non-web app that uses sessions: like number 1, but copy your cookies into a WebView, do authenticate in there, then copy the cookies back.

Re:Ask HN: Fastest/easiest framework to build a web applicat... by nickthemagicman on Monday January 27, 2020 @04:54PM (#22164240)
How is deploying Django? Is it easy to integrate with Nginx or Apache?

I know PHP is super easy but wasn't sure how it was for Python frameworks?

Re:Ask HN: Fastest/easiest framework to build a web applicat... by DangitBobby on Tuesday January 28, 2020 @04:01AM (#22167675)
You run collectstatic to get all of your static assets in one folder, use gunicorn (python package, there are other options as well such as uwsgi) to serve your wsgi server, and have nginx in front of gunicorn to intercept anything with /static/* to pull from your static assets folder. This is all 3 or 4 lines of config in nginx.

Your first try might take a couple of hours to get right. If you want HTTPS (you should) Caddy might be a better route than nginx. It's certainly easier.

Re:Ask HN: Fastest/easiest framework to build a web applicat... by franga2000 on Monday January 27, 2020 @05:06PM (#22164334)
For Apache, the easiest is just using mod_wsgi and pointing it at your source folder. It takes 3 trivial lines of Apache configs if you're using system-wide Python and 2 additional slightly longer ones to use a virtualenv instead (recommended) - all nice and copy-pastable from the official docs.

Nginx has a similar module, but I haven't used it personally.