Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use "test_project" for manual testing #120

Closed
toolness opened this issue May 25, 2021 · 4 comments
Closed

Document how to use "test_project" for manual testing #120

toolness opened this issue May 25, 2021 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@toolness
Copy link
Contributor

While working on #118, I wanted to run a Django project with the dashboard manually so I could make sure that everything looked and worked as expected.

The solution I landed on is a bit circuitous but it seemed to get the job done. First I created a test_project/config/settings_manual.py file with the following content:

from .settings import *

DATABASES["dashboard"] = DATABASES["default"]

Then I made a file called .env that set some environment variables:

export DATABASE_URL=postgres://myuser:mypassword@localhost/django_sql_dashboard_test_project
export DJANGO_SETTINGS_MODULE=config.settings_manual

Then I could manually test out any changes by running source .env and then using manage.py to create a superuser, run the dev server, and so forth.

With a few more permanent changes to the test_project folder in the codebase though, I think that it might be possible to support this better as a development use-case. But at the same time, I also understand that the test_project folder may never have been intended to actually be used manually... in any case, if you think this is a valid use of the test project, I could try submitting a PR and/or documentation that makes it a bit easier.

@simonw
Copy link
Owner

simonw commented Jun 6, 2021

Yes, the test_project folder exists purely so I can get pytest to work.

You're right: how to actually develop against this is something that should be covered in the contributing docs.

I do it by having another Django project that I'm working on, then in that project's virtual environment I switch to the django-sql-dashboard folder and run pip install -e . - I should document this pattern!

@simonw
Copy link
Owner

simonw commented Jun 6, 2021

That said, I think tour suggestion to make changes to test_project to support using it for development like this is a good one. Would definitely appreciate a PR that does this.

@simonw simonw changed the title Consider documenting how to use "test_project" for manual testing Document how to use "test_project" for manual testing Jun 6, 2021
@simonw simonw added the documentation Improvements or additions to documentation label Jun 6, 2021
@toolness
Copy link
Contributor Author

Ok cool! Er, would you also accept PRs that add Docker Compose setups (e.g. a docker-compose.yml and possibly a Dockerfile)? I like using it for working on projects without having to worry about setting up its dependencies, and I think it could be especially useful for working with test_project manually, but I also understand if you'd rather keep this free of docker things.

@simonw
Copy link
Owner

simonw commented Jul 1, 2021

Closed by e82f8a6

@simonw simonw closed this as completed Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants