Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Aug 23, 2017
0 parents commit 20fe6a3
Show file tree
Hide file tree
Showing 16 changed files with 333 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
config/settings/local.py

components_root
static_root
media_root

__pycache__
*.pyc
*~
*.swp
.DS_Store

env
env2
env3

*.sqlite3

.coverage
htmlcov

themes
theme
Empty file added config/__init__.py
Empty file.
28 changes: 28 additions & 0 deletions config/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from rdmo.core.settings import *

from .base import *
from .local import *

# add static and templates from local.THEME_DIR to STATICFILES_DIRS and TEMPLATES
try:
STATICFILES_DIRS = [
os.path.join(THEME_DIR, 'static/')
]
TEMPLATES[0]['DIRS'].append(os.path.join(THEME_DIR, 'templates/'))
except NameError:
pass

# prepend the local.BASE_URL to the different URL settings
try:
LOGIN_URL = BASE_URL + LOGIN_URL
LOGIN_REDIRECT_URL = BASE_URL + LOGIN_REDIRECT_URL
LOGOUT_URL = BASE_URL + LOGOUT_URL
ACCOUNT_LOGOUT_REDIRECT_URL = BASE_URL
MEDIA_URL = BASE_URL + MEDIA_URL
STATIC_URL = BASE_URL + STATIC_URL

CSRF_COOKIE_PATH = BASE_URL + '/'
LANGUAGE_COOKIE_PATH = BASE_URL + '/'
SESSION_COOKIE_PATH = BASE_URL + '/'
except NameError:
pass
144 changes: 144 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import os

SITE_ID = 1

PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)

MEDIA_ROOT = os.path.join(BASE_DIR, 'media_root')
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')

BOWER_COMPONENTS_ROOT = os.path.join(BASE_DIR, 'components_root')

FIXTURE_DIRS = (
os.path.join(BASE_DIR, 'fixtures'),
)

'''
E-Mail configuration, see also:
http://rdmo.readthedocs.io/en/latest/configuration/email.html
'''

# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# EMAIL_HOST = 'localhost'
# EMAIL_PORT = '25'
# EMAIL_HOST_USER = ''
# EMAIL_HOST_PASSWORD = ''
# EMAIL_USE_TLS = False
# EMAIL_USE_SSL = False
# DEFAULT_FROM_EMAIL = ''

'''
Allauth configuration, see also:
http://rdmo.readthedocs.io/en/latest/configuration/authentication/allauth.html
'''

# ACCOUNT = True
# ACCOUNT_SIGNUP = True
# SOCIALACCOUNT = False
#
# INSTALLED_APPS += [
# 'allauth',
# 'allauth.account',
# 'allauth.socialaccount'
# 'allauth.socialaccount.providers.facebook',
# 'allauth.socialaccount.providers.github',
# 'allauth.socialaccount.providers.google',
# 'allauth.socialaccount.providers.orcid',
# 'allauth.socialaccount.providers.twitter',
# ]
#
# AUTHENTICATION_BACKENDS.append('allauth.account.auth_backends.AuthenticationBackend')

'''
LDAP, see also:
http://rdmo.readthedocs.io/en/latest/configuration/authentication/ldap.html
'''

# PROFILE_UPDATE = False
#
# import ldap
# from django_auth_ldap.config import LDAPSearch
#
# AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com"
# AUTH_LDAP_BIND_DN = "cn=admin,dc=ldap,dc=example,dc=com"
# AUTH_LDAP_BIND_PASSWORD = "admin"
# AUTH_LDAP_USER_SEARCH = LDAPSearch("dc=ldap,dc=example,dc=com", ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
#
# AUTH_LDAP_USER_ATTR_MAP = {
# "first_name": "givenName",
# "last_name": "sn",
# 'email': 'mail'
# }
#
# AUTHENTICATION_BACKENDS.insert(
# AUTHENTICATION_BACKENDS.index('django.contrib.auth.backends.ModelBackend'),
# 'django_auth_ldap.backend.LDAPBackend'
# )

'''
Shibboleth, see also:
http://rdmo.readthedocs.io/en/latest/configuration/authentication/shibboleth.html
'''

# SHIBBOLETH = True
# PROFILE_UPDATE = False
#
# INSTALLED_APPS += ['shibboleth']
#
# SHIBBOLETH_ATTRIBUTE_MAP = {
# 'uid': (True, 'username'),
# 'givenName': (True, 'first_name'),
# 'sn': (True, 'last_name'),
# 'mail': (True, 'email'),
# }
#
# AUTHENTICATION_BACKENDS.append('shibboleth.backends.ShibbolethRemoteUserBackend')
#
# MIDDLEWARE_CLASSES.insert(
# MIDDLEWARE_CLASSES.index('django.contrib.auth.middleware.AuthenticationMiddleware') + 1,
# 'shibboleth.middleware.ShibbolethRemoteUserMiddleware'
# )
#
# LOGIN_URL = '/Shibboleth.sso/Login?target=/projects'
# LOGOUT_URL = '/Shibboleth.sso/Logout'

'''
Theme, see also:
http://rdmo.readthedocs.io/en/latest/configuration/themes.html
'''

# THEME_DIR = os.path.join(BASE_DIR, 'theme')

'''
Cache, see also:
http://rdmo.readthedocs.io/en/latest/configuration/cache.html
'''

# CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
# 'LOCATION': '127.0.0.1:11211',
# 'KEY_PREFIX': 'rdmo_default'
# },
# 'api': {
# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
# 'LOCATION': '127.0.0.1:11211',
# 'KEY_PREFIX': 'rdmo_api'
# },
# }

'''
Export Formats
'''

# EXPORT_FORMATS = (
# ('pdf', _('PDF')),
# ('rtf', _('Rich Text Format')),
# ('odt', _('Open Office')),
# ('docx', _('Microsoft Office')),
# ('html', _('HTML')),
# ('markdown', _('Markdown')),
# ('mediawiki', _('mediawiki')),
# ('tex', _('LaTeX'))
# )
58 changes: 58 additions & 0 deletions config/settings/sample.local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'''
A secret key for a particular Django installation. This is used to provide
cryptographic signing, and should be set to a unique, unpredictable value.
'''

SECRET_KEY = ''

'''
Debug mode, don't use this in production
'''

DEBUG = True

'''
The list of URLs und which this application available
'''

ALLOWED_HOSTS = ['localhost']

'''
The root url of your application, only needed when its not '/'
'''

# BASE_URL = '/path'

'''
The database connection to be used, see also:
http://rdmo.readthedocs.io/en/latest/configuration/databases.html
'''

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': '',
# 'USER': '',
# 'PASSWORD': '',
# 'HOST': '',
# 'PORT': '',
# }
# }

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': '',
# 'USER': '',
# 'PASSWORD': '',
# 'HOST': '',
# 'PORT': '',
# }
# }

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': '',
# }
# }
52 changes: 52 additions & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from django.conf.urls import include, url
from django.contrib import admin

from rdmo.core.views import home, i18n_switcher

from rdmo.accounts.urls import accounts_patterns, accounts_patterns_api
from rdmo.conditions.urls import conditions_patterns, conditions_patterns_internal, conditions_patterns_api
from rdmo.domain.urls import domain_patterns, domain_patterns_internal, domain_patterns_api
from rdmo.options.urls import options_patterns, options_patterns_internal, options_patterns_api
from rdmo.projects.urls import projects_patterns, projects_patterns_internal, projects_patterns_api
from rdmo.questions.urls import questions_patterns, questions_patterns_internal, questions_patterns_api
from rdmo.tasks.urls import tasks_patterns, tasks_patterns_internal, tasks_patterns_api
from rdmo.views.urls import views_patterns, views_patterns_internal, views_patterns_api


urlpatterns = [
url(r'^$', home, name='home'),

# apps
url(r'^account/', include(accounts_patterns)),
url(r'^conditions/', include(conditions_patterns)),
url(r'^domain/', include(domain_patterns)),
url(r'^options/', include(options_patterns)),
url(r'^projects/', include(projects_patterns)),
url(r'^questions/', include(questions_patterns)),
url(r'^tasks/', include(tasks_patterns)),
url(r'^views/', include(views_patterns)),

# internal AJAX API
url(r'^api/internal/conditions/', include(conditions_patterns_internal, namespace='internal-conditions')),
url(r'^api/internal/domain/', include(domain_patterns_internal, namespace='internal-domain')),
url(r'^api/internal/options/', include(options_patterns_internal, namespace='internal-options')),
url(r'^api/internal/projects/', include(projects_patterns_internal, namespace='internal-projects')),
url(r'^api/internal/questions/', include(questions_patterns_internal, namespace='internal-questions')),
url(r'^api/internal/tasks/', include(tasks_patterns_internal, namespace='internal-tasks')),
url(r'^api/internal/views/', include(views_patterns_internal, namespace='internal-views')),

# programmable API
url(r'^api/v1/accounts/', include(accounts_patterns_api, namespace='api-v1-accounts')),
url(r'^api/v1/conditions/', include(conditions_patterns_api, namespace='api-v1-conditions')),
url(r'^api/v1/domain/', include(domain_patterns_api, namespace='api-v1-domain')),
url(r'^api/v1/options/', include(options_patterns_api, namespace='api-v1-options')),
url(r'^api/v1/projects/', include(projects_patterns_api, namespace='api-v1-projects')),
url(r'^api/v1/questions/', include(questions_patterns_api, namespace='api-v1-questions')),
url(r'^api/v1/tasks/', include(tasks_patterns_api, namespace='api-v1-tasks')),
url(r'^api/v1/views/', include(views_patterns_api, namespace='api-v1-views')),

# langage switcher
url(r'^i18n/([a-z]{2})/$', i18n_switcher, name='i18n_switcher'),

url(r'^admin/', include(admin.site.urls)),
]
7 changes: 7 additions & 0 deletions config/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()
10 changes: 10 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
1 change: 1 addition & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git+https://github.com/rdmorganiser/[email protected]
4 changes: 4 additions & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinx
sphinx-autobuild
sphinx_rtd_theme
recommonmark
1 change: 1 addition & 0 deletions requirements/gunicorn.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gunicorn==19.7.1
1 change: 1 addition & 0 deletions requirements/ldap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
django-auth-ldap==1.2.8
1 change: 1 addition & 0 deletions requirements/memcached.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-memcached==1.58
1 change: 1 addition & 0 deletions requirements/mysql.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mysqlclient==1.3.10
1 change: 1 addition & 0 deletions requirements/postgres.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
psycopg2==2.7.1
1 change: 1 addition & 0 deletions requirements/shibboleth.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git+https://github.com/Brown-University-Library/django-shibboleth-remoteuser.git

0 comments on commit 20fe6a3

Please sign in to comment.