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

Clean settings #320

Merged
merged 17 commits into from
May 15, 2024
Merged

Clean settings #320

merged 17 commits into from
May 15, 2024

Conversation

faucomte97
Copy link
Contributor

@faucomte97 faucomte97 commented Apr 12, 2024

This change is Reviewable

@faucomte97 faucomte97 self-assigned this Apr 12, 2024
Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @faucomte97)


backend/service/settings.py line 203 at r1 (raw file):

# TODO: Go through the commented out middleware and decide if we still need them
MIDDLEWARE = [

let's discuss this

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 9 of 9 files at r3, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @faucomte97)


backend/service/settings.py line 23 at r3 (raw file):

ALLOWED_HOSTS = ["*"]

# Application definition

can we not delete this header?


backend/service/settings.py line 23 at r3 (raw file):

# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

DATABASES = {

add the following to CFL package

# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

def get_databases(base_dir: Path):
    """Get the databases for the Django project.

    Args:
        base_dir: The base directory of the Django project.

    Returns:
        The databases for the django project.
    """
    return {
        "default": {
            "ENGINE": "django.db.backends.sqlite3",
            "NAME": base_dir / "db.sqlite3",
            "ATOMIC_REQUESTS": True,
        }
    }

after from codeforlife.settings import *, write:

DATABASES = get_databases(BASE_DIR)

backend/service/settings.py line 34 at r3 (raw file):

# https://docs.djangoproject.com/en/3.2/howto/static-files/

STATIC_ROOT = BASE_DIR / "static"

some of these static settings are repeated in the RR settings below


backend/service/settings.py line 45 at r3 (raw file):

MEDIA_ROOT = os.path.join(STATIC_ROOT, "email_media/")
LOGIN_REDIRECT_URL = "/teach/dashboard/"
SILENCED_SYSTEM_CHECKS = ["captcha.recaptcha_test_key_error"]

do we need this captcha setting?


backend/service/settings.py line 46 at r3 (raw file):

LOGIN_REDIRECT_URL = "/teach/dashboard/"
SILENCED_SYSTEM_CHECKS = ["captcha.recaptcha_test_key_error"]
RECAPTCHA_DOMAIN = "www.recaptcha.net"

do we need this captcha setting?

@SKairinos
Copy link
Contributor

backend/service/settings.py line 23 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

add the following to CFL package

# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

def get_databases(base_dir: Path):
    """Get the databases for the Django project.

    Args:
        base_dir: The base directory of the Django project.

    Returns:
        The databases for the django project.
    """
    return {
        "default": {
            "ENGINE": "django.db.backends.sqlite3",
            "NAME": base_dir / "db.sqlite3",
            "ATOMIC_REQUESTS": True,
        }
    }

after from codeforlife.settings import *, write:

DATABASES = get_databases(BASE_DIR)

please also do this to omit it from coverage report

def get_databases(base_dir: Path):  # pragma: no cover

we don't need to test this helper

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @faucomte97)

Copy link
Contributor Author

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 5 of 9 files reviewed, 2 unresolved discussions (waiting on @SKairinos)


backend/service/settings.py line 23 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

can we not delete this header?

Done.


backend/service/settings.py line 23 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

please also do this to omit it from coverage report

def get_databases(base_dir: Path):  # pragma: no cover

we don't need to test this helper

Done.


backend/service/settings.py line 34 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

some of these static settings are repeated in the RR settings below

Done.


backend/service/settings.py line 45 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

do we need this captcha setting?

Yes, to silence this error that occurs otherwise during the run script:

image.png


backend/service/settings.py line 46 at r3 (raw file):

Previously, SKairinos (Stefan Kairinos) wrote…

do we need this captcha setting?

Not sure for this one, it might be used by the captcha app to get the Recaptcha script from this domain but I'm not 100% sure. Hard to tell since if I remember correctly we haven't implemented recaptcha yet for the register endpoints.

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @faucomte97)


backend/service/settings.py line 46 at r3 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Not sure for this one, it might be used by the captcha app to get the Recaptcha script from this domain but I'm not 100% sure. Hard to tell since if I remember correctly we haven't implemented recaptcha yet for the register endpoints.

Let's leave it for now, then.

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @faucomte97)

Copy link
Contributor

@SKairinos SKairinos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @faucomte97)

@SKairinos SKairinos merged commit 549b2f8 into development May 15, 2024
3 of 5 checks passed
@SKairinos SKairinos deleted the clean_settings branch May 15, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants