[Django]-Localhost django dev server vs. postgres slow on mac os?

6👍

Two things:

  1. The Django dev server is painfully slow. Any external connections will be restricted by it.
  2. The connection to an external database is limited by your machine’s local upstream and downstream capabilities (the bottleneck usually being your internet connection).

Any time you’re developing locally and connecting to an external database server, it will be slow. For concurrent Drupal development at work, we source control our sites folder and use the same database that, though external, never leaves our local network. It’s still like molasses in Alaska in January.

I strongly recommend setting up PostgreSQL locally and copying your external database to a local one. It isn’t a very time-intensive process and will save you headaches and keep you much more productive.

👤c_harm

0👍

I faced the same problem when I was using replica of my production database in development environment. The problem turned out to to be in django_session table which had a size near Gigabytes. Simplest solution was to clear that table as I did not need to use users session data in development.
I used simple command:

TRUNCATE TABLE 'django_session'

also additional info on the issue can be found here:
https://dba.stackexchange.com/questions/52733/why-django-session-table-grows-on-postgresql

Leave a comment