Earlier quoted context omitted.
DRF is awesome. If you're considering moving to or implementing GraphQL, though, Django + Graphile is amazingly productive and performant. No affiliation, just good experiences. https://www.graphile.org/postgraphile/
If you're using Postgraphile for the API layer and a frontend framework for the view layer, what do you need Django for? Just migrations?
Django 2.2
241–250 of 257 posts
Re: Django 2.2
#242Earlier quoted context omitted.
I don't use multiple apps anymore and instead treat the project as the app, so my directory structure looks something like this ('project' can change to something specific to what you're working on): * manage.py * project/settings.py * project/urls.py * project/models/ (each model gets it's own file here) * project/views/ (same for views) ...and so on. And in `INSTALLED_APPS` I just add 'project'. Makes it so I don't…
That looks like rails. What made you settle on this given that Django promotes a different structure? I am curious as I like this approach as well, but would be nervous about making life harder by not following the framework and community path.
Re: Django 2.2
#243Earlier quoted context omitted.
If you're using Postgraphile for the API layer and a frontend framework for the view layer, what do you need Django for? Just migrations?
Postgraphile solves the problem of boilerplate CRUD very well but it does not handle custom and complex logic well. For instance, interacting with other APIs like payment.
Re: Django 2.2
#244Earlier quoted context omitted.
We split into multiple apps within one project/site for separation of concerns instead of reusability. We have ~370 apps and nest them quite heavily, probably ~30 at the top level. This works well for us and we've managed to scale nicely to 15 people working on the codebase quite nicely.
What do you mean by nesting apps? Like group them into domain folders and have multiple apps within a domain folder?
django_project/top_level_app/second_level_app/
in top_level_app you then could do
from second_level_app.models import model1
or from a different top level app:
from other_top_level_app.second_level_app.mixins import a_mixin
Re: Django 2.2
#245Earlier quoted context omitted.
As a Django enthusiast and python programmer, I often want less magic from Django, not more. This makes pyramid or flask seem tempting to me. If I wanted Rails that badly, I would simply port my code to Ruby.
Django is supposed to be the “Rails” of Python, allowing programmers who want a Rails-like experience to continue using Python instead of switching languages completely. If you don’t want “magic” then your solution is right - just use Flask.
A small nitpick: While Django may indeed fill that role, it's actually older than Rails, so wasn't "supposed" to do that. Both projects have been created independently of each other.
Re: Django 2.2
#246Earlier quoted context omitted.
What do you mean by nesting apps? Like group them into domain folders and have multiple apps within a domain folder?
I assume Dan really means a nested directory structure, like so: django_project/top_level_app/second_level_app/ in top_level_app you then could do from second_level_app.models import model1 or from a different top level app: from other_top_level_app.second_level_app.mixins import a_mixin
Unfortunately app names have a global namespace within Django's model registry, so we often have to prefix nested apps.
The place where this really works nicely is user facing features and internal editing interfaces, or in features where we have N of a feature that are all similar. For the former, we might have an app such as "blog", and then a nested app within that called "blog_editor". This way we can separate blog models, business logic and user-facing behaviour, from CRUD interfaces designed for internal users. In the latter, if we have 3 shipping providers, we might have an app "shipping" with the core shipping models, with nested apps for "ups", "royal_mail", "dpd", etc, each of which might have the necessary models needed to manage uploading to their APIs, business logic, etc. There may be a common-ish interface exposed by these apps.
This structure is probably the thing I like most about Django over, say, Rails. It's not necessary for all Django projects, but I think it's pretty nice.
Re: Django 2.2
#247Earlier quoted context omitted.
Try serving your static content from a specialized host, for example firebase hosting. Then, you don’t need to serve any static content from your API server and can do away with nginx. Use the whitenoise package for serving the Django admin pages if you still need them for administrative tasks.
Or serve statics from uWSGI (which also provides a spooler, cron and shared cachemem that works with python and Django but that's another story), here in optimized version for best results according to lighthouse: uwsgi --plugin=python3,http,router_static,router_cache --mime-file /etc/mime.types --offload-threads '%k' --file-serve-mode x-accel-redirect --route '^/static/.* addheader:Cache-Control: public, max-age=777…
Re: Django 2.2
#248This release includes the Watchman based reloader I worked on for about a year. It turns out auto reloading in Python is not an easy task, and I’m really nervous about edge cases I haven’t considered! I’ve actually had a nightmare where everyone’s auto reloader was broken. While it never runs in production (right?!) it’s actually a pretty critical bit of Django that had not been touched in about 10 years!
Re: Django 2.2
#249I'm coming from a systems and desktop background and looking into a web side project. My only experience with backend frameworks is a few months with Django for a small project at work. Is Django still a thriving development community? And is it able to handle a large amount of concurrent users? Basically is it a good choice for a backend for a new project? The web tech world moves really fast, and I like that Django…
I have an assortment of Django and flask-based websites and Django still works fine for new projects from my perspective, with the normal caveat that it really depends on what you want to do with it. If i had to redo some of my projects I'd probably use the Django rest framework more heavily as I ended up duplicating a lot of that functionality writing Ajax endpoints way back in the day, but I've not encountered issu…
Re: Django 2.2
#250Earlier quoted context omitted.
That perception usually seems to be more related to the strength of one's own ideological commitment than to the actual state of the threads. People on each side perceive the community to be biased, and people who are intensely on one side perceive the community to be extremely biased. https://hn.algolia.com/?query=%22hostile%20media%20effect%22...
i'm not going to do a study of the culture of hn because i am not an anthropologist but i have many times responded to comments that were vile, that broke the rules, that did not get flagged because they toed the party line, that were in effect supported by the community https://news.ycombinator.com/item?id=17032257 a selectively enforced set of laws becomes defacto discriminatory and ideological: https://scholarship…