Skip to content

Commit

Permalink
updates docs
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Oct 20, 2024
1 parent 55f7fcc commit fe04a3a
Show file tree
Hide file tree
Showing 10 changed files with 746 additions and 10 deletions.
37 changes: 37 additions & 0 deletions docs/_scripts/get_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pathlib import Path

from country_workspace.config import env

MD_HEADER = """
# Setttings
"""
MD_LINE = """
### {key}
_Default_: `{default_value}`
{help}
"""
DEV_LINE = """
__Suggested value for development__: `{develop_value}`
"""

with (Path(__file__).parent.parent / "src" / "settings.md").open("w") as f:

f.write(MD_HEADER)
for entry, cfg in sorted(env.config.items()):
f.write(
MD_LINE.format(
key=entry, default_value=cfg["default"], develop_value=env.get_develop_value(entry), help=cfg["help"]
)
)
if env.get_develop_value(entry):
f.write(
DEV_LINE.format(
key=entry,
default_value=cfg["default"],
develop_value=env.get_develop_value(entry),
help=cfg["help"],
)
)
3 changes: 3 additions & 0 deletions docs/src/.pages
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
nav:
- Home: index.md
- contributing.md
- run
- settings.md
- dev_helpers.md
9 changes: 9 additions & 0 deletions docs/src/dev_helpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Development Helpers and Tools

## ::: country_workspace.security.backends.AnyUserAuthBackend

options:
show_bases: false
show_bases: false
show_root_heading: true
show_source: true
2 changes: 2 additions & 0 deletions docs/src/run/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nav:
- Development: dev.md
31 changes: 31 additions & 0 deletions docs/src/run/dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Run Development Version

!!! warning

This is an unsecure development configuration.
DO NOT USE IN PRODUCTION OR


To locally run stable not officially released version, simply

docker run \
--rm \
-p 8000:8000 \
-e HOPE_API_TOKEN=${HOPE_API_TOKEN} \
-e ADMIN_EMAIL="${ADMIN_EMAIL}" \
-e ADMIN_PASSWORD="${ADMIN_PASSWORD}" \
-e ALLOWED_HOSTS="*" \
-e CACHE_URL="redis://[REDIS_SERVER]:[PORT]/0" \
-e CELERY_BROKER_URL=redis://POSTGRES_SERVER]:[PORT]/0 \
-e CSRF_COOKIE_SECURE=False \
-e CSRF_TRUSTED_ORIGINS=http://localhost \
-e DATABASE_URL="${DATABASE_URL}" \
-e DEBUG="1" \
-e DJANGO_ADMIN_URL=admin/ \
-e DJANGO_SETTINGS_MODULE=country_workspace.config.settings \
-e LOGGING_LEVEL="DEBUG" \
-e SECRET_KEY=${SECRET_KEY} \
-e SOCIAL_AUTH_REDIRECT_IS_HTTPS="False" \
-e SENTRY_DSN="${SENTRY_DSN}" \
-e SUPERUSERS="admin," \
unicef/hope-country-workspace:develop
303 changes: 303 additions & 0 deletions docs/src/settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@

# Setttings


### ADMIN_EMAIL
_Default_: ``

Initial user created at first deploy


__Suggested value for development__: `admin`

### ADMIN_PASSWORD
_Default_: ``

Password for initial user created at first deploy


### ALLOWED_HOSTS
_Default_: `[]`

@see https://docs.djangoproject.com/en/5.0/ref/settings#allowed-hosts


__Suggested value for development__: `['127.0.0.1', 'localhost']`

### AUTHENTICATION_BACKENDS
_Default_: `[]`

Extra authentications backends enabled to add. Es. `country_workspace.security.backends.AnyUserAuthBackend`


### CACHE_URL
_Default_: ``

@see https://docs.djangoproject.com/en/5.0/ref/settings#cache-url


__Suggested value for development__: `redis://localhost:6379/0`

### CELERY_BROKER_URL
_Default_: ``

https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html


### CELERY_TASK_ALWAYS_EAGER
_Default_: `False`

@see https://docs.celeryq.dev/en/stable/userguide/configuration.html##std-setting-task_always_eager


__Suggested value for development__: `True`

### CELERY_TASK_EAGER_PROPAGATES
_Default_: `True`

@see https://docs.celeryq.dev/en/stable/userguide/configuration.html##task-eager-propagates


__Suggested value for development__: `True`

### CELERY_VISIBILITY_TIMEOUT
_Default_: `1800`

@see https://docs.celeryq.dev/en/stable/userguide/configuration.html##broker-transport-options


__Suggested value for development__: `1800`

### CSRF_COOKIE_SECURE
_Default_: `True`

@see https://docs.djangoproject.com/en/5.0/ref/settings#csrf-cookie-secure


### CSRF_TRUSTED_ORIGINS
_Default_: `localhost`




### DATABASE_URL
_Default_: `<NoValue>`

https://django-environ.readthedocs.io/en/latest/types.html#environ-env-db-url


__Suggested value for development__: `<NoValue>`

### DEBUG
_Default_: `False`

@see https://docs.djangoproject.com/en/5.0/ref/settings#debug


__Suggested value for development__: `True`

### EMAIL_HOST
_Default_: ``

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-host


### EMAIL_HOST_PASSWORD
_Default_: ``

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-host-password


### EMAIL_HOST_USER
_Default_: ``

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-host-user


### EMAIL_PORT
_Default_: `25`

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-port


__Suggested value for development__: `25`

### EMAIL_SUBJECT_PREFIX
_Default_: `[Hope-cw]`

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-subject-prefix


__Suggested value for development__: `[Hope-ce]`

### EMAIL_TIMEOUT
_Default_: `None`

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-timeout


### EMAIL_USE_LOCALTIME
_Default_: `False`

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-use-localtime


### EMAIL_USE_SSL
_Default_: `False`

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-use-ssl


### EMAIL_USE_TLS
_Default_: `False`

@see https://docs.djangoproject.com/en/5.0/ref/settings#email-use-tls


### FILE_STORAGE_DEFAULT
_Default_: `django.core.files.storage.FileSystemStorage`




__Suggested value for development__: `@see https://docs.djangoproject.com/en/5.0/ref/settings#storages`

### FILE_STORAGE_MEDIA
_Default_: `django.core.files.storage.FileSystemStorage`




__Suggested value for development__: `@see https://docs.djangoproject.com/en/5.0/ref/settings#storages`

### FILE_STORAGE_STATIC
_Default_: `django.contrib.staticfiles.storage.StaticFilesStorage`




__Suggested value for development__: `@see https://docs.djangoproject.com/en/5.0/ref/settings#storages`

### HOPE_API_TOKEN
_Default_: ``

Hope API token


### LOGGING_LEVEL
_Default_: `CRITICAL`

@see https://docs.djangoproject.com/en/5.0/ref/settings#logging-level


__Suggested value for development__: `DEBUG`

### MEDIA_ROOT
_Default_: `/var/media/`

@see https://docs.djangoproject.com/en/5.0/ref/settings#media-root


__Suggested value for development__: `/tmp/media`

### MEDIA_URL
_Default_: `/media/`

@see https://docs.djangoproject.com/en/5.0/ref/settings#media-root


__Suggested value for development__: `/media`

### ROOT_TOKEN
_Default_: ``




### ROOT_TOKEN_HEADER
_Default_: `x-root-token`




__Suggested value for development__: `x-root-token`

### SECRET_KEY
_Default_: ``

@see https://docs.djangoproject.com/en/5.0/ref/settings#secret-key


__Suggested value for development__: `super_secret_key_just_for_testing`

### SENTRY_DSN
_Default_: ``

Sentry DSN


### SENTRY_ENVIRONMENT
_Default_: `production`

Sentry Environment


__Suggested value for development__: `develop`

### SENTRY_URL
_Default_: ``

Sentry server url


### SOCIAL_AUTH_LOGIN_URL
_Default_: `/login/`




### SOCIAL_AUTH_RAISE_EXCEPTIONS
_Default_: `False`




__Suggested value for development__: `True`

### SOCIAL_AUTH_REDIRECT_IS_HTTPS
_Default_: `True`




### STATIC_ROOT
_Default_: `/var/static`

@see https://docs.djangoproject.com/en/5.0/ref/settings#static-root


__Suggested value for development__: `/tmp/static`

### STATIC_URL
_Default_: `/static/`

@see https://docs.djangoproject.com/en/5.0/ref/settings#static-url


__Suggested value for development__: `/static/`

### SUPERUSERS
_Default_: `[]`

"list of emails/or usernames that will automatically granted superusers privileges ONLY the first time they are created .
This is designed to be used in dev/qa environments deployed by CI, where database can be empty.



### TIME_ZONE
_Default_: `UTC`

@see https://docs.djangoproject.com/en/5.0/ref/settings#std-setting-TIME_ZONE


__Suggested value for development__: `UTC`
Loading

0 comments on commit fe04a3a

Please sign in to comment.