SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 100e3004 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Update settings mongo db

parent 7141d999
No related branches found
No related tags found
No related merge requests found
...@@ -209,7 +209,13 @@ DATABASES = { ...@@ -209,7 +209,13 @@ DATABASES = {
'PORT': '5432', 'PORT': '5432',
} }
} }
MONGO_DATABASE = {
'database': 'scipost',
'host': 'localhost',
'user': '',
'password': '',
'port': '27017',
}
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/ # https://docs.djangoproject.com/en/1.8/topics/i18n/
......
...@@ -23,3 +23,7 @@ WEBPACK_LOADER['DEFAULT']['BUNDLE_DIR_NAME'] = '/home/jdewit/webapps/scipost_sta ...@@ -23,3 +23,7 @@ WEBPACK_LOADER['DEFAULT']['BUNDLE_DIR_NAME'] = '/home/jdewit/webapps/scipost_sta
# Logging # Logging
LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/home/jdewit/webapps/scipost/logs/arxiv.log' LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/home/jdewit/webapps/scipost/logs/arxiv.log'
LOGGING['handlers']['scipost_file_doi']['filename'] = '/home/jdewit/webapps/scipost/logs/doi.log' LOGGING['handlers']['scipost_file_doi']['filename'] = '/home/jdewit/webapps/scipost/logs/doi.log'
MONGO_DATABASE['user'] = get_secret('MONGO_DB_USER')
MONGO_DATABASE['password'] = get_secret('MONGO_DB_PASSWORD')
MONGO_DATABASE['port'] = get_secret("MONGO_DB_PORT")
from django.db import models from django.db import models
from django.conf import settings
from mongoengine import connect, DynamicDocument, ListField, StringField,\ from mongoengine import connect, DynamicDocument, ListField, StringField,\
DynamicField, URLField, DateTimeField DynamicField, URLField, DateTimeField
...@@ -7,7 +9,12 @@ from .managers import CitableQuerySet ...@@ -7,7 +9,12 @@ from .managers import CitableQuerySet
# Make the connection to MongoDB - this could be put in settings.py as well # Make the connection to MongoDB - this could be put in settings.py as well
# It uses default settings for the mongo server # It uses default settings for the mongo server
connect('scipost') connect(settings.MONGO_DATABASE['database'],
host=settings.MONGO_DATABASE['host'],
user=settings.MONGO_DATABASE['user'],
password=settings.MONGO_DATABASE['password']
port=settings.MONGO_DATABASE['port'])
class Citable(DynamicDocument): class Citable(DynamicDocument):
""" """
...@@ -60,4 +67,3 @@ class CitableWithDOI(Citable): ...@@ -60,4 +67,3 @@ class CitableWithDOI(Citable):
def times_cited(self): def times_cited(self):
return CitableWithDOI.objects.cited_by(self.doi).count() return CitableWithDOI.objects.cited_by(self.doi).count()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment