-
Notifications
You must be signed in to change notification settings - Fork 1
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
Containerize application, remove unused edit_data and make_races management commands #175
Conversation
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.
cool - steps work as expected (with a few minor changes)
clicking around, most pages look good but these both give a DoesNotExist
error:
http://localhost:8000/candidates/hector-balderas-3046/
http://localhost:8000/candidates/michelle-lujan-grisham-2243/
Here's the stack trace:
Environment:
Request Method: GET
Request URL: http://localhost:8000/candidates/michelle-lujan-grisham-2243/
Django Version: 1.11.29
Python Version: 3.6.15
Installed Applications:
['django_pdb',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'bootstrap_pagination',
'rest_framework',
'camp_fin.apps.CampFinConfig',
'pages.apps.PagesConfig',
'ckeditor',
'raven.contrib.django.raven_compat']
Installed Middleware:
['raven.contrib.django.middleware.DjangoRestFrameworkCompatMiddleware',
'raven.contrib.django.middleware.SentryMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware']
Traceback:
File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py" in __get__
178. rel_obj = getattr(instance, self.cache_name)
During handling of the above exception ('Office' object has no attribute '_office_type_cache'), another exception occurred:
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/detail.py" in get
116. context = self.get_context_data(object=self.object)
File "/app/camp_fin/views.py" in get_context_data
1191. ot=latest_campaign.office.office_type.id,
File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py" in __get__
184. rel_obj = self.get_object(instance)
File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py" in get_object
159. return qs.get(self.field.get_reverse_related_filter(instance))
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py" in get
380. self.model._meta.object_name
Exception Type: DoesNotExist at /candidates/michelle-lujan-grisham-2243/
Exception Value: OfficeType matching query does not exist.
README.md
Outdated
To import the New Mexico campaign finance data into your database, run the `import_data` command: | ||
|
||
``` | ||
```bash | ||
python manage.py import_data |
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.
python manage.py import_data | |
docker-compose run --rm app python manage.py import_data |
README.md
Outdated
python manage.py import_data | ||
python manage.py make_search_index |
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.
python manage.py make_search_index | |
docker-compose run --rm app python manage.py make_search_index |
Thanks, @derekeder. Fixed! To re-run the import, remove your generated data files, flush the data, then re-import:
Then check the pages that were erroring previously and confirm they work. |
# We've already popped the header row off the first sheet, above. | ||
# Skip header row for subsequent sheets. | ||
if idx > 0: | ||
next(rows) |
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.
This is the fix.
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.
fix worked! looks good
Description
This PR containerizes the application, to aid local development and in anticipation of migrating to Heroku from AWS.
Testing instructions