##// END OF EJS Templates
add asgi.py
Renato-TUF -
r373:607cbdade291
parent child
Show More
@@ -0,0 +1,13
1 import os
2
3 from channels.routing import ProtocolTypeRouter
4 from django.core.asgi import get_asgi_application
5
6 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
7
8 application = ProtocolTypeRouter(
9 {
10 "http": get_asgi_application(),
11 # Just HTTP for now. (We can add other protocols later.)
12 }
13 ) No newline at end of file
@@ -1,37 +1,39
1 FROM python:3.9.16-slim-bullseye
1 FROM python:3.9.16-slim-bullseye
2
2
3 # set working directory
3 # set working directory
4 RUN mkdir /radarsys
4 RUN mkdir /radarsys
5 RUN pwd
5 RUN pwd
6 WORKDIR /radarsys
6 WORKDIR /radarsys
7 COPY /pipLibraries ./
7 COPY /pipLibraries ./
8 RUN pwd
8 RUN pwd
9 RUN ls -al
9 RUN ls -al
10
10
11 # Install python dependences
11 # Install python dependences
12 ADD requirements.txt ./requirements.txt
12 ADD requirements.txt ./requirements.txt
13 RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \
13 RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \
14 gcc \
14 gcc \
15 g++ \
15 g++ \
16 && pip install -v --timeout 120 --no-cache-dir ./Django-4.1.5-py3-none-any.whl \
16 && pip install -v --timeout 120 --no-cache-dir ./Django-4.1.5-py3-none-any.whl \
17 && pip install -v --timeout 120 --no-cache-dir ./django-bootstrap5-22.2.tar.gz \
17 && pip install -v --timeout 120 --no-cache-dir ./django-bootstrap5-22.2.tar.gz \
18 && pip install -v --timeout 120 --no-cache-dir ./psycopg2_binary-2.9.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
18 && pip install -v --timeout 120 --no-cache-dir ./psycopg2_binary-2.9.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
19 && pip install -v --timeout 120 --no-cache-dir ./django-polymorphic-3.1.0.tar.gz \
19 && pip install -v --timeout 120 --no-cache-dir ./django-polymorphic-3.1.0.tar.gz \
20 && pip install -v --timeout 120 --no-cache-dir ./numpy-1.24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
20 && pip install -v --timeout 120 --no-cache-dir ./numpy-1.24.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
21 && pip install -v --timeout 120 --no-cache-dir ./bokeh-3.0.3-py3-none-any.whl\
21 && pip install -v --timeout 120 --no-cache-dir ./bokeh-3.0.3-py3-none-any.whl\
22 && pip install -v --timeout 120 --no-cache-dir ./matplotlib-3.6.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
22 && pip install -v --timeout 120 --no-cache-dir ./matplotlib-3.6.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
23 && pip install -v --timeout 120 --no-cache-dir ./scipy-1.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
23 && pip install -v --timeout 120 --no-cache-dir ./scipy-1.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \
24 && pip install -v --timeout 120 --no-cache-dir ./celery-5.2.7.tar.gz \
24 && pip install -v --timeout 120 --no-cache-dir ./celery-5.2.7.tar.gz \
25 && pip install -v --timeout 120 --no-cache-dir ./gunicorn-20.1.0-py3-none-any.whl \
25 && pip install -v --timeout 120 --no-cache-dir ./gunicorn-20.1.0-py3-none-any.whl \
26 && pip install -v --timeout 120 --no-cache-dir ./requests-2.28.2-py3-none-any.whl \
26 && pip install -v --timeout 120 --no-cache-dir ./requests-2.28.2-py3-none-any.whl \
27 && pip install -v --timeout 120 --no-cache-dir ./redis-4.4.2-py3-none-any.whl \
27 && pip install -v --timeout 120 --no-cache-dir ./redis-4.4.2-py3-none-any.whl \
28 && pip install -v --timeout 120 --no-cache-dir ./graphene_django-3.0.0-py2.py3-none-any.whl \
28 && pip install -v --timeout 120 --no-cache-dir ./graphene_django-3.0.0-py2.py3-none-any.whl \
29 && pip install -v --timeout 120 --no-cache-dir ./channels-4.0.0.tar.gz \
30 && pip install -v --timeout 120 --no-cache-dir ./daphne-4.0.0.tar.gz \
29 #&& pip install -v --timeout 120 -r requirements.txt --no-cache-dir \
31 #&& pip install -v --timeout 120 -r requirements.txt --no-cache-dir \
30 && apt-get purge -y --auto-remove gcc g++\
32 && apt-get purge -y --auto-remove gcc g++\
31 && rm -rf /var/lib/apt/lists/*
33 && rm -rf /var/lib/apt/lists/*
32
34
33 # Copy the main application.
35 # Copy the main application.
34 COPY . ./
36 COPY . ./
35
37
36 EXPOSE 8000
38 EXPOSE 8000
37
39
@@ -1,167 +1,167
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 ]
31 ]
32 #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/
32 #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/
33
33
34 # Application definition
34 # Application definition
35
35
36 INSTALLED_APPS = [
36 INSTALLED_APPS = [
37 'django.contrib.admin',
37 'django.contrib.admin',
38 'django.contrib.auth',
38 'django.contrib.auth',
39 'django.contrib.contenttypes',
39 'django.contrib.contenttypes',
40 'django.contrib.sessions',
40 'django.contrib.sessions',
41 'django.contrib.messages',
41 'django.contrib.messages',
42 'django.contrib.staticfiles',
42 'django.contrib.staticfiles',
43 'apps.accounts',
43 'apps.accounts',
44 'apps.main',
44 'apps.main',
45 'apps.misc',
45 'apps.misc',
46 'apps.rc',
46 'apps.rc',
47 'apps.dds',
47 'apps.dds',
48 'apps.jars',
48 'apps.jars',
49 'apps.usrp',
49 'apps.usrp',
50 'apps.abs',
50 'apps.abs',
51 'apps.cgs',
51 'apps.cgs',
52 'apps.dds_rest',
52 'apps.dds_rest',
53 "django_bootstrap5",
53 "django_bootstrap5",
54 'polymorphic',
54 'polymorphic',
55 ]
55 ]
56
56
57 MIDDLEWARE = [
57 MIDDLEWARE = [
58 'django.middleware.security.SecurityMiddleware',
58 'django.middleware.security.SecurityMiddleware',
59 'django.contrib.sessions.middleware.SessionMiddleware',
59 'django.contrib.sessions.middleware.SessionMiddleware',
60 'django.middleware.common.CommonMiddleware',
60 'django.middleware.common.CommonMiddleware',
61 'django.middleware.csrf.CsrfViewMiddleware',
61 'django.middleware.csrf.CsrfViewMiddleware',
62 'django.contrib.auth.middleware.AuthenticationMiddleware',
62 'django.contrib.auth.middleware.AuthenticationMiddleware',
63 'django.contrib.messages.middleware.MessageMiddleware',
63 'django.contrib.messages.middleware.MessageMiddleware',
64 'django.middleware.clickjacking.XFrameOptionsMiddleware',
64 'django.middleware.clickjacking.XFrameOptionsMiddleware',
65
65
66 ]
66 ]
67
67
68 ROOT_URLCONF = 'radarsys.urls'
68 ROOT_URLCONF = 'radarsys.urls'
69
69
70 TEMPLATES = [
70 TEMPLATES = [
71 {
71 {
72 'BACKEND': 'django.template.backends.django.DjangoTemplates',
72 'BACKEND': 'django.template.backends.django.DjangoTemplates',
73 'DIRS': [os.path.join(BASE_DIR, "templates")],
73 'DIRS': [os.path.join(BASE_DIR, "templates")],
74 'APP_DIRS': True,
74 'APP_DIRS': True,
75 'OPTIONS': {
75 'OPTIONS': {
76 'context_processors': [
76 'context_processors': [
77 'django.template.context_processors.debug',
77 'django.template.context_processors.debug',
78 'django.template.context_processors.request',
78 'django.template.context_processors.request',
79 'django.contrib.auth.context_processors.auth',
79 'django.contrib.auth.context_processors.auth',
80 'django.contrib.messages.context_processors.messages',
80 'django.contrib.messages.context_processors.messages',
81 'apps.main.processors.radarsys_globals',
81 'apps.main.processors.radarsys_globals',
82 ],
82 ],
83 },
83 },
84 },
84 },
85 ]
85 ]
86
86
87 WSGI_APPLICATION = 'radarsys.wsgi.application'
87 WSGI_APPLICATION = 'radarsys.wsgi.application'
88
88 ASGI_APPLICATION = 'radarsys.asgi.application'
89
89
90 # Database
90 # Database
91 # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
91 # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
92
92
93 DATABASES = {
93 DATABASES = {
94 # 'default': {
94 # 'default': {
95 # 'ENGINE': 'django.db.backends.sqlite3',
95 # 'ENGINE': 'django.db.backends.sqlite3',
96 # 'NAME': 'radarsys.sqlite',
96 # 'NAME': 'radarsys.sqlite',
97 # }
97 # }
98 'default': {
98 'default': {
99 'ENGINE': 'django.db.backends.postgresql_psycopg2',
99 'ENGINE': 'django.db.backends.postgresql_psycopg2',
100 'NAME': os.environ.get('DB_NAME', 'radarsys'),
100 'NAME': os.environ.get('DB_NAME', 'radarsys'),
101 'USER': os.environ.get('DB_USER', 'docker'),
101 'USER': os.environ.get('DB_USER', 'docker'),
102 'PASSWORD': os.environ.get('DB_PASSWORD', 'docker'),
102 'PASSWORD': os.environ.get('DB_PASSWORD', 'docker'),
103 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'localhost'),
103 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'localhost'),
104 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', '5432'),
104 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', '5432'),
105 }
105 }
106 }
106 }
107
107
108 # Internationalization
108 # Internationalization
109 # https://docs.djangoproject.com/en/1.8/topics/i18n/
109 # https://docs.djangoproject.com/en/1.8/topics/i18n/
110
110
111 LANGUAGE_CODE = 'en-us'
111 LANGUAGE_CODE = 'en-us'
112
112
113 USE_TZ = False #True
113 USE_TZ = False #True
114
114
115 TIME_ZONE = os.environ.get('TZ', 'America/Lima')
115 TIME_ZONE = os.environ.get('TZ', 'America/Lima')
116
116
117 USE_I18N = True
117 USE_I18N = True
118
118
119 USE_L10N = True
119 USE_L10N = True
120
120
121 # Static files (CSS, JavaScript, Images)
121 # Static files (CSS, JavaScript, Images)
122 # https://docs.djangoproject.com/en/1.8/howto/static-files/
122 # https://docs.djangoproject.com/en/1.8/howto/static-files/
123
123
124 MEDIA_URL = '/media/'
124 MEDIA_URL = '/media/'
125 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
125 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
126
126
127 STATICFILES_DIRS = [
127 STATICFILES_DIRS = [
128 os.path.join(BASE_DIR, 'radarsys/static/')
128 os.path.join(BASE_DIR, 'radarsys/static/')
129 ]
129 ]
130
130
131 STATIC_URL = '/static/'
131 STATIC_URL = '/static/'
132 STATIC_ROOT = os.path.join(BASE_DIR, 'static')
132 STATIC_ROOT = os.path.join(BASE_DIR, 'static')
133
133
134 LOGIN_URL = 'login'
134 LOGIN_URL = 'login'
135 LOGOUT_URL = 'logout'
135 LOGOUT_URL = 'logout'
136 LOGIN_REDIRECT_URL = '/admin'
136 LOGIN_REDIRECT_URL = '/admin'
137 LOGOUT_REDIRECT_URL = '/'
137 LOGOUT_REDIRECT_URL = '/'
138
138
139 STATICFILES_FINDERS = (
139 STATICFILES_FINDERS = (
140 'django.contrib.staticfiles.finders.FileSystemFinder',
140 'django.contrib.staticfiles.finders.FileSystemFinder',
141 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
141 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
142 )
142 )
143
143
144 # # Celery stuff
144 # # Celery stuff
145
145
146 # REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost')
146 # REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost')
147 # #REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1')
147 # #REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1')
148 # REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
148 # REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
149
149
150 # BROKER_TRANSPORT = 'redis'
150 # BROKER_TRANSPORT = 'redis'
151 # #BROKER_URL = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
151 # #BROKER_URL = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
152 # BROKER_URL = 'redis://{}:{}'.format(REDIS_HOST, REDIS_PORT)
152 # BROKER_URL = 'redis://{}:{}'.format(REDIS_HOST, REDIS_PORT)
153
153
154 # CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
154 # CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
155 # CELERY_BROKER_TRANSPORT = BROKER_URL
155 # CELERY_BROKER_TRANSPORT = BROKER_URL
156 # CELERY_ACCEPT_CONTENT = ['application/json']
156 # CELERY_ACCEPT_CONTENT = ['application/json']
157 # CELERY_TASK_SERIALIZER = 'json'
157 # CELERY_TASK_SERIALIZER = 'json'
158 # CELERY_RESULT_SERIALIZER = 'json'
158 # CELERY_RESULT_SERIALIZER = 'json'
159 # CELERY_ENABLE_UTC = False
159 # CELERY_ENABLE_UTC = False
160 # CELERY_TIMEZONE = 'America/Lima'
160 # CELERY_TIMEZONE = 'America/Lima'
161
161
162 import django
162 import django
163 from django.utils.encoding import force_str
163 from django.utils.encoding import force_str
164 django.utils.encoding.force_text = force_str
164 django.utils.encoding.force_text = force_str
165
165
166 # choose of auto-created primary keys
166 # choose of auto-created primary keys
167 DEFAULT_AUTO_FIELD='django.db.models.AutoField'
167 DEFAULT_AUTO_FIELD='django.db.models.AutoField'
@@ -1,12 +1,14
1 Django==4.1.5
1 Django==4.1.5
2 django-bootstrap5==22.2
2 django-bootstrap5==22.2
3 psycopg2-binary==2.9.5
3 psycopg2-binary==2.9.5
4 django-polymorphic==3.1
4 django-polymorphic==3.1
5 bokeh==3.0.3
5 bokeh==3.0.3
6 numpy==1.24.1
6 numpy==1.24.1
7 matplotlib==3.6.3
7 matplotlib==3.6.3
8 scipy==1.10.0
8 scipy==1.10.0
9 celery==5.2.7
9 celery==5.2.7
10 gunicorn==20.1.0
10 gunicorn==20.1.0
11 requests==2.28.2
11 requests==2.28.2
12 redis==4.4.2
12 redis==4.4.2
13 channels==4.0.0
14 daphne==4.0.0
General Comments 0
You need to be logged in to leave comments. Login now