Skip to content

Commit

Permalink
Fix changeset link in AOI RSS feed (#668)
Browse files Browse the repository at this point in the history
* Fix changeset link in AOI RSS feed

* Fix error in defaul OSMCHA_URL value + read POSTGRES_DATABASE

* Fix settings import
  • Loading branch information
willemarcel authored Feb 16, 2024
1 parent cb935f5 commit 37d2f0c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 27 deletions.
13 changes: 5 additions & 8 deletions config/settings/aws_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
# }
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'osmcha',
'USER': env('POSTGRES_USER'),
'PASSWORD': env('POSTGRES_PASSWORD'),
'HOST': env('PGHOST', default='localhost')
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': env('POSTGRES_DATABASE', default='osmcha'),
'USER': env('POSTGRES_USER'),
'PASSWORD': env('POSTGRES_PASSWORD'),
'HOST': env('PGHOST', default='localhost')
}
}

Expand All @@ -78,6 +78,3 @@
},
'ORDERING_PARAM': 'order_by',
}

# CACHALOT SETTINGS
CACHALOT_ENABLED = False
16 changes: 7 additions & 9 deletions config/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@
# }
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'osmcha',
'USER': env('POSTGRES_USER'),
'PASSWORD': env('POSTGRES_PASSWORD'),
'HOST': env('PGHOST', default='localhost')
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': env('POSTGRES_DATABASE', default='osmcha'),
'USER': env('POSTGRES_USER'),
'PASSWORD': env('POSTGRES_PASSWORD'),
'HOST': env('PGHOST', default='localhost')
}
}
DATABASES['default']['ATOMIC_REQUESTS'] = True
Expand Down Expand Up @@ -352,10 +352,6 @@
},
}

# CACHALOT SETTINGS
CACHALOT_TIMEOUT = 180
CACHALOT_ENABLED = True

# OSM SERVER SETTINGS
OSM_SERVER_URL = env('OSM_SERVER_URL', default='https://www.openstreetmap.org')
OSM_PLANET_BASE_URL = env(
Expand All @@ -378,3 +374,5 @@
'OAUTH_REDIRECT_URI',
default='http://localhost:8000/oauth-landing.html'
)

OSMCHA_URL = env('OSMCHA_URL', default='https://osmcha.org')
10 changes: 5 additions & 5 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
# }
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': env('POSTGRES_DATABASE', default='osmcha'),
'USER': env('POSTGRES_USER'),
'PASSWORD': env('POSTGRES_PASSWORD'),
'HOST': env('PGHOST', default='localhost')
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': env('POSTGRES_DATABASE', default='osmcha'),
'USER': env('POSTGRES_USER'),
'PASSWORD': env('POSTGRES_PASSWORD'),
'HOST': env('PGHOST', default='localhost')
}
}
# CACHING
Expand Down
2 changes: 1 addition & 1 deletion osmchadjango/supervise/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ def test_aoi_changesets_feed_view(self):
items = [i for i in rss_data if i.tag == 'item']
link = [i for i in items[0] if i.tag == 'link'][0]
self.assertIn(
"?aoi=",
"https://osmcha.org?aoi=",
link.text
)
self.assertEqual(
Expand Down
6 changes: 2 additions & 4 deletions osmchadjango/supervise/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.contrib.gis.geos import GEOSGeometry, Polygon
from django.contrib.gis.feeds import Feed
from django.urls import reverse
from django.conf import settings

from rest_framework.generics import (
ListCreateAPIView, ListAPIView, RetrieveUpdateDestroyAPIView,
Expand Down Expand Up @@ -139,10 +140,7 @@ def item_geometry(self, item):
return item.bbox

def item_link(self, item):
return '{}{}'.format(reverse(
'frontend:changeset-detail',
args=[item.id]
), '?aoi={}'.format(self.feed_id))
return "{}{}".format(settings.OSMCHA_URL, "?aoi={}".format(self.feed_id))

def item_pubdate(self, item):
return item.date
Expand Down

0 comments on commit 37d2f0c

Please sign in to comment.