@@ -1,169 +1,170 | |||||
1 | """ |
|
1 | """ | |
2 | Django settings for radarsys project. |
|
2 | Django settings for radarsys project. | |
3 |
|
3 | |||
4 | Generated by 'django-admin startproject' using Django 1.8.6. |
|
4 | Generated by 'django-admin startproject' using Django 1.8.6. | |
5 |
|
5 | |||
6 | For more information on this file, see |
|
6 | For more information on this file, see | |
7 | https://docs.djangoproject.com/en/1.8/topics/settings/ |
|
7 | https://docs.djangoproject.com/en/1.8/topics/settings/ | |
8 |
|
8 | |||
9 | For the full list of settings and their values, see |
|
9 | For the full list of settings and their values, see | |
10 | https://docs.djangoproject.com/en/1.8/ref/settings/ |
|
10 | https://docs.djangoproject.com/en/1.8/ref/settings/ | |
11 | """ |
|
11 | """ | |
12 |
|
12 | |||
13 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
|
13 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
14 | import os |
|
14 | import os | |
15 |
|
15 | |||
16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
|
16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
17 |
|
17 | |||
18 | # Quick-start development settings - unsuitable for production |
|
18 | # Quick-start development settings - unsuitable for production | |
19 | # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ |
|
19 | # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ | |
20 |
|
20 | |||
21 | # SECURITY WARNING: keep the secret key used in production secret! |
|
21 | # SECURITY WARNING: keep the secret key used in production secret! | |
22 | SECRET_KEY = 'xshb$k5fc-+j16)cvyffj&9u__0q3$l!hieh#+tbzqg)*f^km0' |
|
22 | SECRET_KEY = 'xshb$k5fc-+j16)cvyffj&9u__0q3$l!hieh#+tbzqg)*f^km0' | |
23 |
|
23 | |||
24 | # SECURITY WARNING: don't run with debug turned on in production! |
|
24 | # SECURITY WARNING: don't run with debug turned on in production! | |
25 | DEBUG = True |
|
25 | DEBUG = True | |
26 |
|
26 | |||
27 | ALLOWED_HOSTS = ['*'] |
|
27 | ALLOWED_HOSTS = ['*'] | |
28 |
|
28 | |||
29 | CSRF_TRUSTED_ORIGINS=[ |
|
29 | CSRF_TRUSTED_ORIGINS=[ | |
30 | "http://*.localhost:8030", |
|
30 | "http://*.localhost:8030", | |
31 | "http://localhost:8030", |
|
31 | "http://localhost:8030", | |
32 | "http://127.0.0.1:8030" |
|
32 | "http://127.0.0.1:8030" | |
33 | ] |
|
33 | ] | |
34 | #Si se requiere que la aplicación salga de este entorno, para otros usuarios es necesario hacer una API request https://fractalideas.com/blog/making-react-and-django-play-well-together-single-page-app-model/ |
|
34 | #Si se requiere que la aplicación salga de este entorno, para otros usuarios es necesario hacer una API request https://fractalideas.com/blog/making-react-and-django-play-well-together-single-page-app-model/ | |
35 |
|
35 | |||
36 | # Application definition |
|
36 | # Application definition | |
37 |
|
37 | |||
38 | INSTALLED_APPS = [ |
|
38 | INSTALLED_APPS = [ | |
39 | 'django.contrib.admin', |
|
39 | 'django.contrib.admin', | |
40 | 'django.contrib.auth', |
|
40 | 'django.contrib.auth', | |
41 | 'django.contrib.contenttypes', |
|
41 | 'django.contrib.contenttypes', | |
42 | 'django.contrib.sessions', |
|
42 | 'django.contrib.sessions', | |
43 | 'django.contrib.messages', |
|
43 | 'django.contrib.messages', | |
44 | 'django.contrib.staticfiles', |
|
44 | 'django.contrib.staticfiles', | |
45 | 'apps.accounts', |
|
45 | 'apps.accounts', | |
46 | 'apps.main', |
|
46 | 'apps.main', | |
47 | 'apps.misc', |
|
47 | 'apps.misc', | |
48 | 'apps.rc', |
|
48 | 'apps.rc', | |
49 | 'apps.dds', |
|
49 | 'apps.dds', | |
50 | 'apps.jars', |
|
50 | 'apps.jars', | |
51 | 'apps.usrp', |
|
51 | 'apps.usrp', | |
52 | 'apps.abs', |
|
52 | 'apps.abs', | |
53 | 'apps.cgs', |
|
53 | 'apps.cgs', | |
54 | 'apps.dds_rest', |
|
54 | 'apps.dds_rest', | |
55 | "django_bootstrap5", |
|
55 | "django_bootstrap5", | |
56 | 'polymorphic', |
|
56 | 'polymorphic', | |
|
57 | 'channels', | |||
57 | ] |
|
58 | ] | |
58 |
|
59 | |||
59 | MIDDLEWARE = [ |
|
60 | MIDDLEWARE = [ | |
60 | 'django.middleware.security.SecurityMiddleware', |
|
61 | 'django.middleware.security.SecurityMiddleware', | |
61 | 'django.contrib.sessions.middleware.SessionMiddleware', |
|
62 | 'django.contrib.sessions.middleware.SessionMiddleware', | |
62 | 'django.middleware.common.CommonMiddleware', |
|
63 | 'django.middleware.common.CommonMiddleware', | |
63 | 'django.middleware.csrf.CsrfViewMiddleware', |
|
64 | 'django.middleware.csrf.CsrfViewMiddleware', | |
64 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
65 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
65 | 'django.contrib.messages.middleware.MessageMiddleware', |
|
66 | 'django.contrib.messages.middleware.MessageMiddleware', | |
66 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|
67 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
67 |
|
68 | |||
68 | ] |
|
69 | ] | |
69 |
|
70 | |||
70 | ROOT_URLCONF = 'radarsys.urls' |
|
71 | ROOT_URLCONF = 'radarsys.urls' | |
71 |
|
72 | |||
72 | TEMPLATES = [ |
|
73 | TEMPLATES = [ | |
73 | { |
|
74 | { | |
74 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|
75 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
75 | 'DIRS': [os.path.join(BASE_DIR, "templates")], |
|
76 | 'DIRS': [os.path.join(BASE_DIR, "templates")], | |
76 | 'APP_DIRS': True, |
|
77 | 'APP_DIRS': True, | |
77 | 'OPTIONS': { |
|
78 | 'OPTIONS': { | |
78 | 'context_processors': [ |
|
79 | 'context_processors': [ | |
79 | 'django.template.context_processors.debug', |
|
80 | 'django.template.context_processors.debug', | |
80 | 'django.template.context_processors.request', |
|
81 | 'django.template.context_processors.request', | |
81 | 'django.contrib.auth.context_processors.auth', |
|
82 | 'django.contrib.auth.context_processors.auth', | |
82 | 'django.contrib.messages.context_processors.messages', |
|
83 | 'django.contrib.messages.context_processors.messages', | |
83 | 'apps.main.processors.radarsys_globals', |
|
84 | 'apps.main.processors.radarsys_globals', | |
84 | ], |
|
85 | ], | |
85 | }, |
|
86 | }, | |
86 | }, |
|
87 | }, | |
87 | ] |
|
88 | ] | |
88 |
|
89 | |||
89 | WSGI_APPLICATION = 'radarsys.wsgi.application' |
|
90 | WSGI_APPLICATION = 'radarsys.wsgi.application' | |
90 | ASGI_APPLICATION = 'radarsys.asgi.application' |
|
91 | ASGI_APPLICATION = 'radarsys.asgi.application' | |
91 |
|
92 | |||
92 | # Database |
|
93 | # Database | |
93 | # https://docs.djangoproject.com/en/1.8/ref/settings/#databases |
|
94 | # https://docs.djangoproject.com/en/1.8/ref/settings/#databases | |
94 |
|
95 | |||
95 | DATABASES = { |
|
96 | DATABASES = { | |
96 | # 'default': { |
|
97 | # 'default': { | |
97 | # 'ENGINE': 'django.db.backends.sqlite3', |
|
98 | # 'ENGINE': 'django.db.backends.sqlite3', | |
98 | # 'NAME': 'radarsys.sqlite', |
|
99 | # 'NAME': 'radarsys.sqlite', | |
99 | # } |
|
100 | # } | |
100 | 'default': { |
|
101 | 'default': { | |
101 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', |
|
102 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
102 | 'NAME': os.environ.get('DB_NAME', 'radarsys'), |
|
103 | 'NAME': os.environ.get('DB_NAME', 'radarsys'), | |
103 | 'USER': os.environ.get('DB_USER', 'docker'), |
|
104 | 'USER': os.environ.get('DB_USER', 'docker'), | |
104 | 'PASSWORD': os.environ.get('DB_PASSWORD', 'docker'), |
|
105 | 'PASSWORD': os.environ.get('DB_PASSWORD', 'docker'), | |
105 | 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'localhost'), |
|
106 | 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'localhost'), | |
106 | 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', '5432'), |
|
107 | 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', '5432'), | |
107 | } |
|
108 | } | |
108 | } |
|
109 | } | |
109 |
|
110 | |||
110 | # Internationalization |
|
111 | # Internationalization | |
111 | # https://docs.djangoproject.com/en/1.8/topics/i18n/ |
|
112 | # https://docs.djangoproject.com/en/1.8/topics/i18n/ | |
112 |
|
113 | |||
113 | LANGUAGE_CODE = 'en-us' |
|
114 | LANGUAGE_CODE = 'en-us' | |
114 |
|
115 | |||
115 | USE_TZ = False #True |
|
116 | USE_TZ = False #True | |
116 |
|
117 | |||
117 | TIME_ZONE = os.environ.get('TZ', 'America/Lima') |
|
118 | TIME_ZONE = os.environ.get('TZ', 'America/Lima') | |
118 |
|
119 | |||
119 | USE_I18N = True |
|
120 | USE_I18N = True | |
120 |
|
121 | |||
121 | USE_L10N = True |
|
122 | USE_L10N = True | |
122 |
|
123 | |||
123 | # Static files (CSS, JavaScript, Images) |
|
124 | # Static files (CSS, JavaScript, Images) | |
124 | # https://docs.djangoproject.com/en/1.8/howto/static-files/ |
|
125 | # https://docs.djangoproject.com/en/1.8/howto/static-files/ | |
125 |
|
126 | |||
126 | MEDIA_URL = '/media/' |
|
127 | MEDIA_URL = '/media/' | |
127 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media') |
|
128 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media') | |
128 |
|
129 | |||
129 | STATICFILES_DIRS = [ |
|
130 | STATICFILES_DIRS = [ | |
130 | os.path.join(BASE_DIR, 'radarsys/static/') |
|
131 | os.path.join(BASE_DIR, 'radarsys/static/') | |
131 | ] |
|
132 | ] | |
132 |
|
133 | |||
133 | STATIC_URL = '/static/' |
|
134 | STATIC_URL = '/static/' | |
134 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') |
|
135 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') | |
135 |
|
136 | |||
136 | LOGIN_URL = 'login' |
|
137 | LOGIN_URL = '/accounts/login' | |
137 | LOGOUT_URL = 'logout' |
|
138 | LOGOUT_URL = 'logout' | |
138 | LOGIN_REDIRECT_URL = '/admin' |
|
139 | LOGIN_REDIRECT_URL = '/admin' | |
139 | LOGOUT_REDIRECT_URL = '/' |
|
140 | LOGOUT_REDIRECT_URL = '/' | |
140 |
|
141 | |||
141 | STATICFILES_FINDERS = ( |
|
142 | STATICFILES_FINDERS = ( | |
142 | 'django.contrib.staticfiles.finders.FileSystemFinder', |
|
143 | 'django.contrib.staticfiles.finders.FileSystemFinder', | |
143 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
144 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | |
144 | ) |
|
145 | ) | |
145 |
|
146 | |||
146 | # # Celery stuff |
|
147 | # # Celery stuff | |
147 |
|
148 | |||
148 | # REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost') |
|
149 | # REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost') | |
149 | # #REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1') |
|
150 | # #REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1') | |
150 | # REDIS_PORT = os.environ.get('REDIS_PORT', 6379) |
|
151 | # REDIS_PORT = os.environ.get('REDIS_PORT', 6379) | |
151 |
|
152 | |||
152 | # BROKER_TRANSPORT = 'redis' |
|
153 | # BROKER_TRANSPORT = 'redis' | |
153 | # #BROKER_URL = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT) |
|
154 | # #BROKER_URL = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT) | |
154 | # BROKER_URL = 'redis://{}:{}'.format(REDIS_HOST, REDIS_PORT) |
|
155 | # BROKER_URL = 'redis://{}:{}'.format(REDIS_HOST, REDIS_PORT) | |
155 |
|
156 | |||
156 | # CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT) |
|
157 | # CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT) | |
157 | # CELERY_BROKER_TRANSPORT = BROKER_URL |
|
158 | # CELERY_BROKER_TRANSPORT = BROKER_URL | |
158 | # CELERY_ACCEPT_CONTENT = ['application/json'] |
|
159 | # CELERY_ACCEPT_CONTENT = ['application/json'] | |
159 | # CELERY_TASK_SERIALIZER = 'json' |
|
160 | # CELERY_TASK_SERIALIZER = 'json' | |
160 | # CELERY_RESULT_SERIALIZER = 'json' |
|
161 | # CELERY_RESULT_SERIALIZER = 'json' | |
161 | # CELERY_ENABLE_UTC = False |
|
162 | # CELERY_ENABLE_UTC = False | |
162 | # CELERY_TIMEZONE = 'America/Lima' |
|
163 | # CELERY_TIMEZONE = 'America/Lima' | |
163 |
|
164 | |||
164 | import django |
|
165 | import django | |
165 | from django.utils.encoding import force_str |
|
166 | from django.utils.encoding import force_str | |
166 | django.utils.encoding.force_text = force_str |
|
167 | django.utils.encoding.force_text = force_str | |
167 |
|
168 | |||
168 | # choose of auto-created primary keys |
|
169 | # choose of auto-created primary keys | |
169 | DEFAULT_AUTO_FIELD='django.db.models.AutoField' |
|
170 | DEFAULT_AUTO_FIELD='django.db.models.AutoField' |
General Comments 0
You need to be logged in to leave comments.
Login now