Hi y’all,
I helped out with a Django Girls workshop in Tokyo yesterday. It all went really well thanks to both the straightforwardness of Django itself and the hard work of the DG team to make such good teaching materials!
There is still this thing that bugs me a lot though, deployment. Even as someone who has brought up a lot of sites, I feel like when you have vanilla Django, getting something deployed involves a lot of steps and a lot of places where you can make subtle mistakes.
Warning: this is more spitballing some ideas than anything.
Right now, if you want to get a website up and running on a remote server you need to:
- set up a virtualenv over there/get Django etc installed
- set up your WSGI server
- set up static file serving
- set up your WSGI->HTTP server (maybe not necessary with gunicorn)
- do migrations and whatnot
- also, set up domain stuff
I’m going to think about the usual “simple” case for a bit. Someone making a blog with Django.
They are probably well served with a gunicorn + nginx (really it would be nice for a WSGI addendum to allow for pointing to static files that don’t eat up a web worker but…). They probably are running on some sort of linux OS where you could easily get supervisor running.
It’s also likely that a simple sqlite file would be sufficient.
In a magical world, there would be a management command that you could run that would generate the right sort of configuration files to run your Django application. Maybe a first management command (makedeploymentconf
) that you could run on your own machine, where you get prompted for some stuff. You would say “please use this folder path on the deployment machine to store anything I might need”
then a second script would be generated that, when run on the server, would:
- set up a virtual env in the path provided in the first command
- check that (for example) you have supervisor + nginx installed
- offer to symlink the configuration scripts for you to those places (and have log files pointed into the folder you specified in the first command)
In an even more magical world, it would be cool if you could point something like supervisor to your django app folder, and some capabilities discovery
There is “just use Docker”, which I kinda dislike because it’s really heavy and opaque, especially once you have stuff working on your machine.
There is also stuff like “just use Heroku”, which is a bit more legitimate. Heroku has this library where it autoconfigures your settings file with one line. Bit magical but gets the job done.
Yesterday, one person (a designer who was learning Django to figure out stuff on the backend) was like “for my job I just send stuff via FTP, is that how I do it with this Django project?” I think if we can somehow make it the case that would be awesome. I think asking people to install something globally from a package repo usually is fine (virtualenvs are harder because you have to do a bunch of path management and the like).
I am motivated to figure out how we could improve this stuff, but don’t know where to direct this energy ATM. I would love to hear if anyone else here has any feelings/ideas in this space