Supporting a template database for test db

82 views
Skip to first unread message

Melvyn Sopacua

unread,
Mar 22, 2017, 6:53:11 AM3/22/17
to django-d...@googlegroups.com

Hi,

 

I'm currently running into the problem that in order to run tests, I need to grant my database user super-user privileges.

No problem for dev, but I'd like to avoid that on any system resembling production.

 

This is a Postgresql specific issue, as there is no seperate privilege I can grant that makes it more secure, but even if there was / is going to be, I'd be reluctant to grant it.

I do however want to be able to run tests in staging / production environments.

 

The problem can be avoided by using a template database that already has the required extensions installed. The problem obviously exists for django.contrib.postgres but also for django.contrib.gis and any reusable apps that require an extension (like the custom JSONField implementations out there).

 

I did a coarse search if this was discussed before, but template and database are common words in this group :), so if this has been discussed before, feel free to point me to it.

 

The question being: is there any aversion to supporting TEMPLATE in the DATABASES[TEST] setting and that the database will then be created using the template database (so mapping to CREATE DATABASE ... TEMPLATE ..)?

--

Melvyn Sopacua

Florian Apolloner

unread,
Mar 22, 2017, 8:33:19 AM3/22/17
to Django developers (Contributions to Django itself)
Sounds sensible to me.

Tim Graham

unread,
Mar 22, 2017, 9:12:50 AM3/22/17
to Django developers (Contributions to Django itself)
This is already implemented in Django 1.11: https://code.djangoproject.com/ticket/27061.

Melvyn Sopacua

unread,
Mar 22, 2017, 7:09:49 PM3/22/17
to django-d...@googlegroups.com

On Wednesday 22 March 2017 06:12:49 Tim Graham wrote:

> This is already implemented in Django 1.11:

> https://code.djangoproject.com/ticket/27061.

 

Fantastic, thank you.

 

--

Melvyn Sopacua

Reply all
Reply to author
Forward
0 new messages