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

use django-environ for managing environmental settings in cookicutters #386

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fgregg
Copy link
Member

@fgregg fgregg commented Oct 9, 2024

Overview

This PR adjusts the settings.py for the django and wagtail cookiecutters to make good use of django-environ.

It also fixes a number of unrelated dependency problems, and turns off automated dependency upgrading.

Closes #381, #387

Relates to #385

Testing Instructions

  • Pull down this branch and check it out
  • create project from the new-django-app project
  • go into the the new project and run "docker compose up"
  • after building, confirm that the web app is available
  • do the same for the wagtail cookie cutter

run: |
git config --global user.name "xmedr"
git config --global user.email "[email protected]"
# - name: Push to main branch
Copy link
Member Author

Choose a reason for hiding this comment

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

automated updating of requirements go us to a point where we these cookie cutters were in a broken state. let's pause until we can figure out a better way to upgrade deps.

@@ -25,12 +25,9 @@
"css-loader": "^7.1.2",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
Copy link
Member Author

Choose a reason for hiding this comment

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

all of the deps are not compatible with eslint 9.12

@@ -3,7 +3,7 @@
Django
psycopg2
gunicorn
dj-database-url
Copy link
Member Author

Choose a reason for hiding this comment

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

we don't need this with django-environ

@@ -56,4 +56,4 @@ ENV DJANGO_DEBUG 'False'

# Build static files into the container
RUN python manage.py collectstatic --noinput
RUN python manage.py compress
Copy link
Member Author

Choose a reason for hiding this comment

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

this was failing with this error. I don't know why, but it's unrelated to the django-environ stuff.

 > [app 12/12] RUN python manage.py compress:
0.668 Traceback (most recent call last):
0.668   File "/app/manage.py", line 22, in <module>
0.668     main()
0.668   File "/app/manage.py", line 18, in main
0.668 AWS config not found, defaulting to local storage
0.668 Compressing... Invalid template project/base.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/static_page.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/500.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/404.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/home_page.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/react_page.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668     execute_from_command_line(sys.argv)
0.668   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
0.668     utility.execute()
0.668   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
0.668     self.fetch_command(subcommand).run_from_argv(self.argv)
0.668   File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 413, in run_from_argv
0.669     self.execute(*args, **cmd_options)
0.669   File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 459, in execute
0.669     output = self.handle(*args, **options)
0.669              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.669   File "/usr/local/lib/python3.11/site-packages/compressor/management/commands/compress.py", line 370, in handle
0.669     self.handle_inner(**options)
0.669   File "/usr/local/lib/python3.11/site-packages/compressor/management/commands/compress.py", line 395, in handle_inner
0.669     offline_manifest, block_count, results = self.compress(
0.669                                              ^^^^^^^^^^^^^^
0.670   File "/usr/local/lib/python3.11/site-packages/compressor/management/commands/compress.py", line 296, in compress
0.670     raise OfflineGenerationError(
0.670 compressor.exceptions.OfflineGenerationError: No 'compress' template tags found in templates.Try running compress command with --follow-links and/or--extension=EXTENSIONS
------

django-compressor==4.5.1
django-storages==1.14.4
boto3==1.35.34
sentry-sdk==2.15.0
wagtail==6.2.2
csvkit==2.0.1
wagtail-modeladmin==2.0.0
Copy link
Member Author

Choose a reason for hiding this comment

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

unrelated dep fixing.

@@ -1,4 +1,4 @@
from wagtail.core import blocks
from wagtail import blocks
Copy link
Member Author

Choose a reason for hiding this comment

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

all the wagtail stuff is unrelated dependency fixing.

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.

Adopt django-environ to manage environment variables
1 participant