Will & Skill Developers

Will & Skill Developers


Thoughts, snippets and ideas from the team at Will & Skill AB, Stockholm.

Faisal Mahmud
Author

Faisal Mahmud

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

Resetting a database in Postgres

Sometimes when You are trying things out and You feel that Your Django migration files are getting out of hand and You want to start clean it might be a good idea to start fresh. Instead of truncating separate tables in a large database You can just drop the database and the recreate it. Follow these steps Become the postgres user with su…

Faisal MahmudFaisal Mahmud

When PostGIS and pg_dump does not play well together

I was trying to make pg_dump backup of our database. When I got the error shown below: pg_dump: [archiver (db)] query failed: ERROR: permission denied for schema topology pg_dump: [archiver (db)] query was: COPY topology.topology TO stdout; This error is caused due to the fact that the user that own the topology table might be the po…

Faisal MahmudFaisal Mahmud

Backing up and restoring a Postgres database

Backup Simple example as postgres user The example below will create plaintext dump of your database. $ sudo su postgres $ pg_dump [database_name] > database.sql If you want to save it as snapshots it is smarter to compress the output $ pg_dump -Fc [database_name] > database.bak # compressed binary format $ pg_dump -Ft [database_nam…

Faisal MahmudFaisal Mahmud

DEBUG mode in Django templates

A lot of people add their own context processor but there is a better and safer way to do this in Django. The necessary steps Set DEBUG = True in your settings.py Add your current IP to INTERNAL_IPS in your settings.py Your settings.py file # settings.py # Set DEBUG = True DEBUG = True # Add the IP of your computer INTERNAL_IPS = ["127.…

Faisal MahmudFaisal Mahmud