-
Notifications
You must be signed in to change notification settings - Fork 11
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
Upgrade Django #961
Open
aaronxsu
wants to merge
1
commit into
develop
Choose a base branch
from
feature/asu/upgrade-django
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Upgrade Django #961
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
# Note: the Django and psycopg2 versions are repeated in requirements.txt for the benefit | ||
# of the analysis container. The base container and requirements file versions should be kept | ||
# in sync. | ||
FROM quay.io/azavea/django:3.2-python3.10-slim | ||
|
||
MAINTAINER Azavea | ||
FROM python:3.10-slim-bullseye | ||
|
||
WORKDIR /usr/src | ||
COPY requirements.txt /tmp/ | ||
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt | ||
|
||
RUN set -ex \ | ||
&& buildDeps=" \ | ||
build-essential \ | ||
libpq-dev \ | ||
" \ | ||
&& deps=" \ | ||
gdal-bin \ | ||
libgdal-dev \ | ||
gettext \ | ||
postgresql-client-13 \ | ||
" \ | ||
&& apt-get update && apt-get install -y $buildDeps $deps --no-install-recommends \ | ||
&& pip install --no-cache-dir -r /tmp/requirements.txt \ | ||
&& apt-get purge -y --auto-remove $buildDeps \ | ||
&& rm -rf /tmp/requirements.txt /var/lib/apt/lists/* | ||
|
||
COPY . /usr/src | ||
WORKDIR /usr/src | ||
|
||
EXPOSE 9202 | ||
|
||
CMD ["-w", "1", \ | ||
"-b", "0.0.0.0:9202", \ | ||
"--reload", \ | ||
"--log-level", "info", \ | ||
"--error-logfile", "-", \ | ||
"--forwarded-allow-ips", "*", \ | ||
"-k", "gevent", \ | ||
"pfb_network_connectivity.wsgi"] | ||
ENTRYPOINT ["/usr/local/bin/gunicorn"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
|
||
bind = ":9202" | ||
accesslog = "-" | ||
errorlog = "-" | ||
workers = 3 | ||
worker_class = 'gevent' | ||
loglevel = "Info" | ||
|
||
ENVIRONMENT = os.getenv("DJANGO_ENV", "dev") | ||
|
||
if ENVIRONMENT == "development": | ||
reload = True | ||
else: | ||
preload = True | ||
|
||
wsgi_app = "pfb_network_connectivity.wsgi" |
56 changes: 56 additions & 0 deletions
56
src/django/pfb_analysis/migrations/0050_update_pfb_analysis_and_user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Generated by Django 4.2.17 on 2024-12-19 21:54 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('pfb_analysis', '0049_neighborhood_geog'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='analysisbatch', | ||
name='created_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='analysisbatch', | ||
name='modified_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='analysisjob', | ||
name='created_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='analysisjob', | ||
name='modified_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='analysislocaluploadtask', | ||
name='created_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='analysislocaluploadtask', | ||
name='modified_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='neighborhood', | ||
name='created_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='neighborhood', | ||
name='modified_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/django/users/migrations/0005_update_pfb_analysis_and_user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Generated by Django 4.2.17 on 2024-12-19 21:54 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0004_auto_20170509_1559'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='organization', | ||
name='created_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='organization', | ||
name='modified_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='pfbuser', | ||
name='created_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='pfbuser', | ||
name='modified_by', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(app_label)s_%(class)s_related+', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Did you move this out because doing it this way is no longer supported, or because having it in a config file is just nicer?
It seems fine/better to me, but it seems like
-k gevent
didn't make it into the config file. Is that because it's the default, or did it get missed? (I can't say I have any memory of why we set that option, but my default assumption is that there was a reason and it should stay unless there's a reason for it to change.)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.
Similar to the above, this was to align with what the project template does.
I don't have context regarding the reason for
gevent
in there, but we could add the following to thegunicorn.conf.py
. What do you think?Some sources might be helpful:
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.
Yeah, adding
worker_class = 'gevent'
sounds good to me.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.
Changed in e0ea151