Skip to content

Commit

Permalink
task/VOGRE-30 (#29)
Browse files Browse the repository at this point in the history
* [VOGRE-30] Removed empty imports

* [VOGRE-3] Removed extra database comments

* [VOGRE-30] Removed JARS secret (depreciated), removed aws credentials

* [VOGRE-30] Removed Conceptpower user id and password as now vogon uses its json public access api

* [VOGRE-30] Removed celery settings (depreciated)

* [VOGRE-30] Removed goat and unwanted goat code, removed submit wait time celery variable

* [VOGRE-3] Removed extra import, removed giles extra settings and obselete code

* [VOGRE-30] Removed obselete variables

* [VOGRE-30] Re added important conceptpower variables

* [VOGRE-30] Removed Giles app since giles uses citesphere in external_accounts uti;s

* [VOGRE-30] Removed duplicate allowed headers variable
  • Loading branch information
Girik1105 authored Dec 19, 2024
1 parent 2ce4c81 commit 8ef519e
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 236 deletions.
28 changes: 0 additions & 28 deletions annotations/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,34 +169,6 @@ def label_from_instance(self, obj):
"""
return obj.uri

def to_python(self, value):
if value in self.empty_values:
return None
try:
key = 'uri'
py_value = self.queryset.get(**{key: value})
except self.queryset.model.DoesNotExist:
import goat
goat.GOAT = settings.GOAT
goat.GOAT_APP_TOKEN = settings.GOAT_APP_TOKEN
concept = goat.Concept.retrieve(identifier=value)

data = dict(
uri=value,
label=concept.data['name'],
description=concept.data['description'],
)
ctype_data = concept.data['concept_type']#
if ctype_data:
data.update({'typed': Type.objects.get_or_create(uri=ctype_data['identifier'])[0]})

py_value = Concept.objects.create(**data)

return py_value
except (ValueError, TypeError):
raise ValidationError(self.error_messages['invalid_choice'], code='invalid_choice')
return py_value


class TemplateChoiceField(forms.ChoiceField):
def label_from_instance(self, obj):
Expand Down
Empty file removed giles/__init__.py
Empty file.
122 changes: 0 additions & 122 deletions giles/functions.py

This file was deleted.

24 changes: 0 additions & 24 deletions giles/migrations/0001_initial.py

This file was deleted.

Empty file removed giles/migrations/__init__.py
Empty file.
14 changes: 0 additions & 14 deletions giles/models.py

This file was deleted.

54 changes: 6 additions & 48 deletions vogon/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os, sys, requests
import os
from urllib.parse import urlparse
import socket
import dj_database_url
# import djcelery
from datetime import timedelta
from dotenv import load_dotenv

load_dotenv()
Expand Down Expand Up @@ -50,12 +46,10 @@
'allauth.socialaccount',
'django_inlinecss',
'concepts',
'giles',
'annotations',
'external_accounts',
'rest_framework',
'corsheaders',
'djcelery',
'repository',
'oauth2_provider',
)
Expand Down Expand Up @@ -105,11 +99,6 @@

WSGI_APPLICATION = 'vogon.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

# DATABASES = {'default': dj_database_url.config()}
# DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'

DATABASES = {
'default': {
Expand All @@ -123,14 +112,12 @@
}


# print DATABASES

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # default
'allauth.account.auth_backends.AuthenticationBackend', #Allauth
)

ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS =True
ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = True
ANONYMOUS_USER_ID = -1

# Allauth Email Settings
Expand Down Expand Up @@ -168,9 +155,6 @@
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# Allow all host headers
ALLOWED_HOSTS = ['*']

# Static asset configuration
BASE_PATH = os.environ.get('BASE_PATH', '/')
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -180,16 +164,12 @@

STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'), )

JARS_KEY = '050814a54ac5c81b990140c3c43278031d391676'
AUTH_USER_MODEL = 'annotations.VogonUser'

es = urlparse(os.environ.get('SEARCHBOX_URL') or 'http://127.0.0.1:9200/')
port = es.port or 80

# AWS Access Key and Secret Key credentials
AWS_ACCESS_KEY = os.environ.get('AWS_ACCESS_KEY', None)
AWS_SECRET_KEY = os.environ.get('AWS_SECRET_KEY', None)
S3_BUCKET = 'vogonweb-test'
# User profile default image
DEFAULT_USER_IMAGE = 'https://s3-us-west-2.amazonaws.com/vogonweb-test/defaultprofile.png'

TEMPORAL_PREDICATES = {
Expand All @@ -216,8 +196,8 @@
}
}

CONCEPTPOWER_USERID = os.environ.get('CONCEPTPOWER_USERID', None)
CONCEPTPOWER_PASSWORD = os.environ.get('CONCEPTPOWER_PASSWORD', None)
CONCEPTPOWER_USERID = os.environ.get('CONCEPTPOWER_USERID')
CONCEPTPOWER_PASSWORD = os.environ.get('CONCEPTPOWER_PASSWORD')
CONCEPTPOWER_ENDPOINT = os.environ.get('CONCEPTPOWER_ENDPOINT')
CONCEPTPOWER_NAMESPACE = os.environ.get('CONCEPTPOWER_NAMESPACE')

Expand All @@ -229,25 +209,10 @@

BASE_URI_NAMESPACE = u'http://www.vogonweb.net'

# Celery config.

# djcelery.setup_loader()
# CELERYBEAT_SCHEDULE = {
# 'accession_ready_relationsets': {
# 'task': 'annotations.tasks.accession_ready_relationsets',
# 'schedule': timedelta(minutes=10, seconds=0),
# },
# }

CELERY_TIMEZONE = 'UTC'

GOOGLE_ANALYTICS_ID = os.environ.get('GOOGLE_ANALYTICS_ID', None)

VERSION = '0.4'

GOAT = os.environ.get('GOAT', 'http://127.0.0.1:8000')
GOAT_APP_TOKEN = os.environ.get('GOAT_APP_TOKEN')

LOGLEVEL = os.environ.get('LOGLEVEL', 'DEBUG')


Expand All @@ -270,16 +235,9 @@
'viaf:geographic': GEOGRAPHIC_CONCEPT_TYPE, # E53 Place
}

SUBMIT_WAIT_TIME = {'days': 3, 'hours': 0, 'minutes': 0}

# Giles Credentials
GILES_ENDPOINT = os.environ.get('GILES_ENDPOINT')
IMAGE_AFFIXES = ['png', 'jpg', 'jpeg', 'tiff', 'tif']
GET = requests.get
POST = requests.post
GILES_APP_TOKEN = os.environ.get('GILES_APP_TOKEN', 'nope')
GILES_DEFAULT_PROVIDER = os.environ.get('GILES_DEFAULT_PROVIDER', 'github')
MAX_GILES_UPLOADS = 20


CONCEPT_URI_PREFIXES = [
'http://www.digitalhps.org/',
Expand Down

0 comments on commit 8ef519e

Please sign in to comment.