geonode-project
geonode-project copied to clipboard
Problem adding local_settings.py to geonode-project implementation
I have implemented the geonode-project with geonode as an app in the "src" directory. This is going to be production implementation, so I want to enable the OAuth app for shared authentication between Geonode and Geoserver. The existing "settings.py" which is installed with the geonode-project, is extremely bare bones and doesn't include any of the apps, middleware classes, authentication backends, etc, that are needed. I thought it would be best to put these in the "local_settings.py" file as that is referenced by the "settings.py". Also, it looked like there were functions in the settings.py file which were looking for the INSTALLED_APPS, for example, so I didn't want to risk putting it in the wrong place in settings. Anyway, I added the following to the local_settings.py file:
INSTALLED_APPS = (
'modeltranslation',
'guardian',
'oauth2_provider',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# The setting below makes it possible to serve different languages per
# user depending on things like headers in HTTP requests.
'django.middleware.locale.LocaleMiddleware',
'pagination.middleware.PaginationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# If you use SessionAuthenticationMiddleware, be sure it appears before OAuth2TokenMiddleware.
# SessionAuthenticationMiddleware is NOT required for using django-oauth-toolkit.
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'oauth2_provider.middleware.OAuth2TokenMiddleware',
)
# Replacement of default authentication backend in order to support
# permissions per object.
AUTHENTICATION_BACKENDS = (
'oauth2_provider.backends.OAuth2Backend',
'django.contrib.auth.backends.ModelBackend',
'guardian.backends.ObjectPermissionBackend',
)
OAUTH2_PROVIDER = {
'SCOPES': {
'read': 'Read scope',
'write': 'Write scope',
'groups': 'Access to your groups'
},
'CLIENT_ID_GENERATOR_CLASS': 'oauth2_provider.generators.ClientIdGenerator',
}
When I kill the uwsgi process, daemon-reload, and then restart geonode-uwsgi service, It fails with an error that the "SITEURL" is not being set properly in "settings.py". I'm not sure how to fix this as it works without "local_settings.py". I am not sure if it is simply not being pulled into "settings.py" properly, or if I need something additional in "local_settings.py" for it to work correctly.
Any assistance would be greatly appreciated. Also, if there are best practices for what apps should be included, whether I should instead modify "settings.py" instead, and/or if it would be safest to simply copy "settings.py" from the geonode core install as it includes all of the entries already, I would really appreciate it.
Thanks, Russell