Django Community Survey
djangoproject.com
djangoproject.com
I often try out new new web dev platforms and frameworks but tend to rewrite projects that get too serious or large in Django, or when I'm starting to miss too many features.
If I know that I am building something that others are going to work on, or if I know that the project will need to be maintained for a considerable amount of time, I tend to go with Django and a few familiar libraries (Celery, Django REST framework, django-extensions) right off the bat, as I feel comfortable that we won't run into issues where some important dependency becomes unmaintained or introduces backwards-incompatible changes. Much thanks to Django's predictable and well thought out releases.
Further, when I pick Django, I know that there is good support in monitoring and crash report systems such as Sentry, New Relic, and others. So that's one less thing to worry about.
The only area where I have started to use other solutions is frontend dev, as I find that the momentum in the Node community is so much higher in this area. I only wish that the Node community wasn't as fragmented and had a more long-term view on releases.
Currently I'm working on a project and I want to use React "the right way". While it's not so hard to just integrate React into Django project, it's not so easy to manage the chaos when things start to grow. At the moment I'm trying to integrate React, webpack, gulp and node (server side rendering for react) into Django workflow and make it work "natural", but right now it just feels hacky and not the way I want it to work.
Would be great if you could share your workflows & ideas.
Basically we'll have our main application server (in this case, .net mvc api, but think django-rest-framework) talk to a node server as well as the client, with the same REST api. The plus is very real separation of concerns (django does all data handling, business logic; javascript does all UI). The downside is having two server stacks.
FWIW, I'm planning to use nuclear-js[1] for flux. And we're considering porting our .net code to django.
To serve different assets in dev and prod I let gulp generate a manifest and have a custom template tag in Django that expands to different paths depending on settings.DEBUG:
{% my_static 'css/all.css' %}
expands to either /static/css/all.css or something like /static/css/all.min.abcd1234.css.If nginx is serving a minified, hashed path it adds a Cache-Control: max-age=31556926 header to the response.
For deployment, I have the root path serve up the client, while the API is on its own subdomain.
It's in Python. Lack of static compilation makes it difficult to detect certain kinds of basic issues until later. Implementing realtime features (websockets, async things) is a less natural fit in Python than other languages. Lack of good concurrency is a more serious issue for me these days as I do a lot of work with game backends. I realize I could use Iron Python or something to get around this, but that doesn't solve the other issues here. The amount of horsepower that I get per megabyte of RAM used in Python vs other languages is also pretty sad. Other compiled languages now are available that stand up to high concurrency loads better on the same hardware for the type of work I do.
For years I've stuck with Django because the admin system and other features let me make fast progress with new projects quickly. I spent a good amount of time with Node and with Go, but lately I'm excited about Elixir and Phoenix, and it looks like that's going to be my go-to toolset for the next few years.
And in addiction to that, it's functional, so I can get the awesome benefits of immutable programming, but without the dizzying complexity of, for example, Scala's type system. And it's based on the Erlang VM, so I get the benefits of battle-hardened concurrency and IO underpinnings.
Previously I stayed away from things like Go and Node/Express, because I felt like it wasn't as easy for the type of work I do as Django, and was missing key things like the admin interface. But when I looked at what's in the Phoenix framework[1] and read the source, it started to feel like I'm witnessing the dawn of the next Ruby on Rails revolution.
Next of DI.. I could just create a new Module/Dependency for my tests.
However I'm still lacking expertise in the testing bits.. Still looking for good books.. About specs / mockito, integration tests etc..
I have found SublimeCodeIntel to be quite helpful even without static typing, fwiw. And I've heard even better things about PyCharm. But I also wrote almost the same thing in my feedback - Python's lack of static typing is a major bummer.
Have you tried Python 3? (I know there are valid reasons not to). But it has function annotations, which are enforceable through tools like typeannotations[0] or mypy[1], and much better support for concurrency with asyncio, and async/await/yield from/etc. Note - I haven't tried these features, I'm curious for the opinions of those who have.
[0] - https://github.com/ceronman/typeannotations [1] - http://mypy-lang.org/
I also suggested that they improve the production deployment situation somehow. I spent two days the first time I deployed a Django app to production, between installing supervisor, gunicorn, nginx, mysql, etc and debugging all the issues. (Mostly getting paths right, and having the wrong .'s in imports.)
Thinking about it a bit more, there could be less directory settings in Django itself. Maybe there could be more "convention over configuration" outside Django too. I do remember it being a pain doing it first time since you don't know where all the log files are.
Django could release and update with every release.
I'm hoping it won't be too hard to add a deployment story at the end.
Deployment is a pain. Perhaps some official tutorials would be good in the interim.
https://github.com/GrahamDumpleton/mod_wsgi-docker
I've been evaluating using uwsgi as a stand-alone server. I'm not sure how much load it would support, but I think it's possible get quite far with Django, sqlite, and uwsgi.
(don't mind the stale release, just use master)
It is a much, much better admin-like tool to use for building CRUD views, with strong conventions on permissions, URL structures and template names. It really simplifies things and we've been using it internally for four years on a dozen different projects.
Can't imagine using Django without it.
Also a huge fan of Django REST framework for how well it does REST APIs, and in particular, the API browser: http://www.django-rest-framework.org/
At work, we have a project with around 30 apps and 170 interrelated migrations. It takes 2-3 minutes to run all the migrations, which have to happen at the beginning of many runs of our test suite.
[1] http://stackoverflow.com/a/28560805/176611 [2] https://docs.djangoproject.com/en/1.8/topics/migrations/#squ...
Turning off migrations is great in the cases it works, but it doesn't provide an easy way to also run the few data migrations that some parts of our code rely on. Obviously we could probably fix this in some non-DRY way, but I'd rather not.
The situation as is, is workable, but it would be way better to improve the performance of this a little (which I have a feeling is definitely possible). When I next get some time to work on this, I'll give it a crack.
For your testing, perhaps you might want to consider the `--keepdb` switch. Not very helpful when you're changing your models though.