Skip to content

Commit

Permalink
Generating static content
Browse files Browse the repository at this point in the history
  • Loading branch information
javierdelapuente committed Feb 27, 2024
1 parent 75f2655 commit c5d356c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions charm_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# configuration exists for each. Full connection details are required in both sections, and it is strongly recommended
# to use two separate database IDs.

redis_hostname = os.environ['DJANGO_REDIS_HOSTNAME']
redis_hostname = os.environ.get('DJANGO_REDIS_HOSTNAME', 'localhost')
redis_port = os.environ.get('DJANGO_REDIS_PORT', 6379)
redis_username = os.environ.get('DJANGO_REDIS_USERNAME', '')
redis_password = os.environ.get('DJANGO_REDIS_PASSWORD', '')
Expand Down Expand Up @@ -113,7 +113,7 @@

# Base URL path if accessing NetBox within a directory. For example, if installed at https://example.com/netbox/, set:
# BASE_PATH = 'netbox/'
BASE_PATH = os.environ.get('DJANGO_SECRET_KEY', '')
BASE_PATH = os.environ["DJANGO_BASE_PATH"]
INTERNAL_IPS = ('127.0.0.1', '::1')

# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
Expand Down
15 changes: 13 additions & 2 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ parts:
- "django/app/project-static"
- "django/app/reports"
- "django/app/scripts"
- "django/app/static"
- "django/app/templates"
- "django/app/tenancy"
- "django/app/translations"
Expand All @@ -59,6 +60,7 @@ parts:
- "django/app/project-static"
- "django/app/reports"
- "django/app/scripts"
- "django/app/static"
- "django/app/templates"
- "django/app/tenancy"
- "django/app/translations"
Expand All @@ -81,6 +83,7 @@ parts:
project-static: "django/app/project-static"
reports: "django/app/reports"
scripts: "django/app/scripts"
static: "django/app/static"
templates: "django/app/templates"
tenancy: "django/app/tenancy"
translations: "django/app/translations"
Expand All @@ -91,14 +94,22 @@ parts:
wireless: "django/app/wireless"
override-pull: |-
craftctl default
mv netbox netbox.orig
cp -R netbox.orig/* .
[ ! -d netbox.orig ] && mv netbox netbox.orig && cp -R netbox.orig/* .
cp charm_configuration.py ./netbox/configuration.py
after:
- django-framework/dependencies
override-build: |-
# A bit ugly...
NETBOX_CONFIGURATION=netbox.configuration_testing PYTHONUSERBASE=${CRAFT_STAGE} python3 manage.py collectstatic --no-input
craftctl default
# pyproject.toml breaks the building
django-framework/dependencies:
override-build: |-
rm -f pyproject.toml
craftctl default
python-packages:
- whitenoise


services:
django:
Expand Down

0 comments on commit c5d356c

Please sign in to comment.