question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

readonly is not a valid Django DB connection.

See original GitHub issue

The documentation suggests the following settings:

EXPLORER_CONNECTIONS = { 'Default': 'readonly' }
EXPLORER_DEFAULT_CONNECTION = 'readonly'

However this results in an error:

django.core.exceptions.ImproperlyConfigured: EXPLORER_CONNECTIONS contains (Default, readonly), but readonly is not a valid Django DB connection.

From doing a quick search (https://github.com/groveco/django-sql-explorer/issues/306), it looks like the solution is changing the settings to:

EXPLORER_CONNECTIONS = { 'Default': 'default' } 
EXPLORER_DEFAULT_CONNECTION = 'default'

Is this is the correct (safe) solution? If so, we should update the documentation.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
spapascommented, Dec 28, 2018

Actually the correct thing to do from a security standpoint is to add another read-only connection to your django settings. So beyond ‘default’ you’ll have a ‘readonly’ key to your DATABASES settings dictionary (that would connect with a user that has read-only access to the tables).

However, the README definitely needs some updating because I can see the following phrase right after EXPLORER_CONNECTIONS is explained:

The first setting lists the connections you want to allow Explorer to use. The keys of the connections dictionary are friendly names to show Explorer users, and the values are the actual database aliases used in settings.DATABASES. It is highly recommended to set

this definitely has something missing and needs to be properly completed!

1reaction
markswebcommented, Oct 8, 2020

@zehawki I became a maintainer a few days ago to try to get things rolling, bring django 3 support etc.

We’re nearly there with thanks to a fair few people actively contributing. And @spapas has just updated the readme in #406 which I think closes this ticket.

Talking of docs, there is a branch with the very beginning of a sphinx setup. I think the README needs refactoring to be a bit more basic in itself with the vast majority of it’s details put into sphinx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specifying Readonly access for Django.db connection object
What I'm trying to figure out is how I can define a read-only database connection that is specific to that command or connection...
Read more >
readonly is not a valid Django DB connection.
The documentation suggests the following settings: EXPLORER_CONNECTIONS = { 'Default': 'readonly' } EXPLORER_DEFAULT_CONNECTION = 'readonly'.
Read more >
django-db-readonly
A way to globally disable writes to your database. This works by inserting a cursor wrapper between Django's CursorWrapper and the database connection's...
Read more >
Read-only connection to database. How to?
Hello there, Is it possible to force database access to be read-only when executing custom SQL? I want to make a simple admin...
Read more >
Model field reference
Avoid using null on string-based fields such as CharField and TextField . If a string-based field has null=True , that means it has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found