Best (easiest) dev setup for GeoDjango

Hi - in my work area, we regularly get students in to work on a Django project who are at the level where they need help getting a virtual environment set up. I would love to assign a Geodjango task or two, but the last time I tried to set it up myself I failed - I had followed the config instructions, as far as I could tell, but somehow the GDAL library or something was never good enough. We’re not

The options seem to be:

  • set up a single system with django & postgis:

    • relatively easy (?) on Ubuntu, even in WSL2
    • harder on Windows (we don’t, by default, give the students admin accounts so they’d need support
      if they’re to run OSGeo4W
  • a set of docker containers with code, django & env in one, and postgis in the other

  • a single container fully(?) configured system (e.g. [Docker Hub] )

Which of these is going to be easiest to teach and get to a working setup for development?

(Something get cut off here? Part of your description is missing?)

It’s not clear to me from the various options you’re identifying what your base working environment is.

Are these company workstations that need to be prepared, or are the students working on their own equipment?

Do the tasks they’re expected to perform run on the “equipment at their fingertips” or on a server in another location?

Are you a small company or part of a larger firm? Size makes some resources available that might not be otherwise, but introduces problems of a different nature. (I know well the difficulties of dealing with IT internal resources of firms with > 25,000 employees.)

How many students and how regularly are you dealing with this? (Some scripting or other background work can quickly become worthwhile if the number of people affected is large enough.)

There are many options for dealing with this beyond what you’ve listed - including, for example, the use of VNC or RDP. Choosing the right one for your environment should take into consideration all of the relevant factors.

Ah woops, thanks Ken. The software is a django platform, (all in a single git repo atm) with a groups-based multi-tenancy where different apps provide distinct interfaces that researchers like to use for brainstorming, ranking, assessing - anything where you have a group of experts and need to structure (and later analyse and report on) their interactions. We’re using it to supplement and slowly replace all the brainstorming on butchers paper, sticky notes, spreadsheets that we used to use. Most of us are not from full software engineering backgrounds, but we can all expected to know python scripting and be comfortable getting technical.

There are 3-5 people developing / maintaining the codebase within our small group inside a fairly big org. Our servers are Ubuntu VMs, but we probably fit into the ‘intranet’ use case in a lot of ways - the volumes aren’t very high at all. We get a couple of students a year around this time, and we often have people from outside our nucleus who want to add their preferred format for info extraction at odd times through the year. It is great that we can ask people to:

  • clone the git repo,
  • create a venv
  • pip install -r requirements.txt and
  • runserver

and be off to the races. But even this still throws people. I don’t want it to get much harder to get started.

One of our students took up the GIS challenge and has succeeded following the Windows guide for Geodjango. It took her ~ a couple of hours. If we bring her app into our project, every developer will need that environment working and up to date and they’ll probably be working on Windows. It would be a lot nicer if it were as simple as that - e.g. just:

  • get docker (my experience with this was not terrible, but it was multistep, with googling at many of them - set up WSL, install a distro, upgrade it to WSL2 etc.)
  • git clone code
  • docker-compose to start the webapp, postgis.

I’m happy enough (now) with the Django for Professionals recommended Docker setup for development, but will need to try whether a postgis image.

We do have access to VMs with virtual Ubuntu desktops, but its a multi-hop citrix connection while we’re mostly working from home, which is slow and sometimes drops out. Also we use PyCharm which is easy on Windows but not on those virtual desktops.

Another approach you could look at is using Anaconda for your Windows build environment. I’ve never used it for Django, but a number of our PEs swear by it.

We also use VSCode with the Remote SSH connector to do remote development in a handful of cases.

Unfortunately, beyond that, I don’t have any good recommendations. You could script something together using PowerShell for your Windows users that could take the pain out of the process, but that’s well outside my areas of knowledge.

1 Like