4 ms·
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 amazi
by franga2000 7y ago
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!!).
- nickthemagicman 7y agoHow 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?
- franga2000 7y agoFor 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.
- DangitBobby 7y agoYou 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.
- Zivanovicb 7y agoHow do you feel about implementing social authentication with Django Rest Framework? What are the packages you'd normally use?
- franga2000 7y agoI 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.