Commit a5ed9533 authored by Marco Frailis's avatar Marco Frailis
Browse files

Updating django_euclid example to a more recent django framework

parent e1eef6f8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2,16 +2,16 @@

Create the anaconda environment for this example

    conda create -n euclid_example django
    conda create -n orm_django django

To activate this environment, use

    conda activate euclid_example
    conda activate orm_django

Additional packages are needed, not available in Anaconda but installed with the `pip` command

    pip install django-extensions djangorestframework
    pip install django-composite-field django-url-filter
    pip install django-composite-field django-ufilter

To deactivate an active environment, use

+20 −18
Original line number Diff line number Diff line
"""
Django settings for euclid_example project.

Generated by 'django-admin startproject' using Django 2.1.1.
Generated by 'django-admin startproject' using Django 4.1.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
https://docs.djangoproject.com/en/4.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
https://docs.djangoproject.com/en/4.1/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '5yu24^zybby@-q_x%ry-nit^!%o8oc2oxmos7d3_d@hf(+qo5k'
SECRET_KEY = 'django-insecure-b=h18+$p+el@nqc+7lb7r^b+@xuo26ip92)pd=-=kjiyty&f@%'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -40,12 +40,13 @@ INSTALLED_APPS = [
    'django_extensions',
    'imagedb',
    'rest_framework',
    'url_filter',
    'django_ufilter',
]


REST_FRAMEWORK = {
    'DEFAULT_FILTER_BACKENDS': [
        'url_filter.integrations.drf.DjangoFilterBackend',
        'django_ufilter.integrations.drf.DRFFilterBackend',
    ]
}

@@ -81,18 +82,18 @@ WSGI_APPLICATION = 'euclid_example.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
@@ -111,7 +112,7 @@ AUTH_PASSWORD_VALIDATORS = [


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

@@ -119,14 +120,15 @@ TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = False


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = 'static/'

STATIC_URL = '/static/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
+1 −1
Original line number Diff line number Diff line
"""euclid_example URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
    https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ WSGI config for euclid_example project.
It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
"""

import os
+2 −0
Original line number Diff line number Diff line
from django.contrib import admin

# Register your models here.

from .models import(Instrument, NispDetector, Astrometry, DataContainer, 
                    NispRawFrame)

Loading