-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
457 deployment bug in staging #463
457 deployment bug in staging #463
Conversation
@@ -9,7 +9,6 @@ readme = "README.md" | |||
python = "^3.11" | |||
Django = "^4.2.1" | |||
djangorestframework = "^3.14.0" | |||
psycopg2-binary = "^2.9.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this package is not a viable solution because psycopg2-binary
is required to connect django to db
if you run docker compose build --no-cache
and then docker compose up
and you'll see that the django container exits with code 1 which prevents us from developing locally
See local docker logs
django | Traceback (most recent call last):
django | File "/usr/local/lib/python3.12/site-packages/django/db/backends/postgresql/base.py", line 25, in <module>
django | import psycopg as Database
django | ModuleNotFoundError: No module named 'psycopg'
django |
django | During handling of the above exception, another exception occurred:
django |
django | Traceback (most recent call last):
django | File "/usr/local/lib/python3.12/site-packages/django/db/backends/postgresql/base.py", line 27, in <module>
django | import psycopg2 as Database
django | ModuleNotFoundError: No module named 'psycopg2'
django |
django | During handling of the above exception, another exception occurred:
django |
django | Traceback (most recent call last):
django | File "/code/manage.py", line 24, in <module>
django | main()
django | File "/code/manage.py", line 20, in main
django | execute_from_command_line(sys.argv)
django | File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
django | utility.execute()
django | File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
django | django.setup()
django | File "/usr/local/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
django | apps.populate(settings.INSTALLED_APPS)
django | File "/usr/local/lib/python3.12/site-packages/django/apps/registry.py", line 116, in populate
django | app_config.import_models()
django | File "/usr/local/lib/python3.12/site-packages/django/apps/config.py", line 269, in import_models
django | self.models_module = import_module(models_module_name)
django | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django | File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
django | return _bootstrap._gcd_import(name[level:], package, level)
django | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django | File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
django | File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
django | File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
django | File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
django | File "<frozen importlib._bootstrap_external>", line 994, in exec_module
django | File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
django | File "/usr/local/lib/python3.12/site-packages/django/contrib/auth/models.py", line 3, in <module>
django | from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
django | File "/usr/local/lib/python3.12/site-packages/django/contrib/auth/base_user.py", line 57, in <module>
django | class AbstractBaseUser(models.Model):
django | File "/usr/local/lib/python3.12/site-packages/django/db/models/base.py", line 143, in __new__
django | new_class.add_to_class("_meta", Options(meta, app_label))
django | File "/usr/local/lib/python3.12/site-packages/django/db/models/base.py", line 371, in add_to_class
django | value.contribute_to_class(cls, name)
django | File "/usr/local/lib/python3.12/site-packages/django/db/models/options.py", line 243, in contribute_to_class
django | self.db_table, connection.ops.max_name_length()
django | ^^^^^^^^^^^^^^
django | File "/usr/local/lib/python3.12/site-packages/django/utils/connection.py", line 15, in __getattr__
django | return getattr(self._connections[self._alias], item)
django | ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
django | File "/usr/local/lib/python3.12/site-packages/django/utils/connection.py", line 62, in __getitem__
django | conn = self.create_connection(alias)
django | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django | File "/usr/local/lib/python3.12/site-packages/django/db/utils.py", line 193, in create_connection
django | backend = load_backend(db["ENGINE"])
django | ^^^^^^^^^^^^^^^^^^^^^^^^^^
django | File "/usr/local/lib/python3.12/site-packages/django/db/utils.py", line 113, in load_backend
django | return import_module("%s.base" % backend_name)
django | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django | File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
django | return _bootstrap._gcd_import(name[level:], package, level)
django | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django | File "/usr/local/lib/python3.12/site-packages/django/db/backends/postgresql/base.py", line 29, in <module>
django | raise ImproperlyConfigured("Error loading psycopg2 or psycopg module")
django | django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 or psycopg module
django exited with code 1
closing since we found a viable fix that pushes changes live to https://stage.civictechjobs.org/ |
Fixes #457
Changes