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

Make default debug settings runable #20

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions config/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
STATIC_ROOT = BASE_DIR / 'static_root'
STATICFILES_DIRS = [BASE_DIR / 'vendor']

# the list of included files can be extended to accommodate a more complex setup
include(
optional('local.py')
)
DEBUG = True # defaults to True for development setup
if DEBUG is True: # can be removed when not required
include('development.py')
else:
# the list of included files can be extended to accommodate a more complex setup
include(optional('local.py'))

# prepend the BASE_URL to the different URL settings
if BASE_URL:
Expand Down
40 changes: 40 additions & 0 deletions config/settings/development.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'''
These are development settings for debug mode, don't use this in production
https://docs.djangoproject.com/en/4.2/ref/settings/
https://github.com/rdmorganiser/rdmo/blob/main/rdmo/core/settings.py
https://rdmo.readthedocs.io/en/latest/development/setup.html
'''

if DEBUG is not True:
from django.core.exceptions import ImproperlyConfigured

raise ImproperlyConfigured('DEBUG must be True for the development settings')

SECRET_KEY = 'this is not a very secret key'
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
SITE_ID = 1

# http://rdmo.readthedocs.io/en/latest/configuration/databases.html
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}

# Optional, theme: http://rdmo.readthedocs.io/en/latest/configuration/themes.html
# INSTALLED_APPS += ['rdmo_theme']

# Optional, RDMO plugins: https://github.com/rdmorganiser?q=rdmo-plugins&type=all&language=&sort=
# INSTALLED_APPS += ['rdmo_pugin']
# PROJECT_EXPORTS += []
# PROJECT_IMPORTS += []

# Optional, browsable API, that comes with the Django Rest Framework
# REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] = (
# 'rest_framework.renderers.JSONRenderer',
# 'rest_framework.renderers.BrowsableAPIRenderer',
# )

# Optional, email port
# EMAIL_PORT = 8025
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ target_version = ["py38", "py39", "py310", "py311"]
[tool.ruff]
target-version = "py38"
line-length = 120

[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
Expand All @@ -25,7 +27,7 @@ ignore = [
"RUF012", # mutable-class-default
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
section-order = [
"future",
"standard-library",
Expand All @@ -38,13 +40,13 @@ section-order = [
"local-folder"
]

[tool.ruff.isort.sections]
[tool.ruff.lint.isort.sections]
pytest = ["pytest"]
django = ["django"]
rest_framework = ["rest_framework"]
rdmo = ["rdmo"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"config/settings/*.py" = [
"F401",
"F403",
Expand Down