##// 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 1 FROM python:3.9.16-slim-bullseye
2 2
3 3 # set working directory
4 4 RUN mkdir /radarsys
5 5 RUN pwd
6 6 WORKDIR /radarsys
7 7 COPY /pipLibraries ./
8 8 RUN pwd
9 9 RUN ls -al
10 10
11 11 # Install python dependences
12 12 ADD requirements.txt ./requirements.txt
13 13 RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \
14 14 gcc \
15 15 g++ \
16 16 && pip install -v --timeout 120 --no-cache-dir ./Django-4.1.5-py3-none-any.whl \
17 17 && pip install -v --timeout 120 --no-cache-dir ./django-bootstrap5-22.2.tar.gz \
18 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 19 && pip install -v --timeout 120 --no-cache-dir ./django-polymorphic-3.1.0.tar.gz \
20 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 21 && pip install -v --timeout 120 --no-cache-dir ./bokeh-3.0.3-py3-none-any.whl\
22 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 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 24 && pip install -v --timeout 120 --no-cache-dir ./celery-5.2.7.tar.gz \
25 25 && pip install -v --timeout 120 --no-cache-dir ./gunicorn-20.1.0-py3-none-any.whl \
26 26 && pip install -v --timeout 120 --no-cache-dir ./requests-2.28.2-py3-none-any.whl \
27 27 && pip install -v --timeout 120 --no-cache-dir ./redis-4.4.2-py3-none-any.whl \
28 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 31 #&& pip install -v --timeout 120 -r requirements.txt --no-cache-dir \
30 32 && apt-get purge -y --auto-remove gcc g++\
31 33 && rm -rf /var/lib/apt/lists/*
32 34
33 35 # Copy the main application.
34 36 COPY . ./
35 37
36 38 EXPOSE 8000
37 39
@@ -1,167 +1,167
1 1 """
2 2 Django settings for radarsys project.
3 3
4 4 Generated by 'django-admin startproject' using Django 1.8.6.
5 5
6 6 For more information on this file, see
7 7 https://docs.djangoproject.com/en/1.8/topics/settings/
8 8
9 9 For the full list of settings and their values, see
10 10 https://docs.djangoproject.com/en/1.8/ref/settings/
11 11 """
12 12
13 13 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14 14 import os
15 15
16 16 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 17
18 18 # Quick-start development settings - unsuitable for production
19 19 # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
20 20
21 21 # SECURITY WARNING: keep the secret key used in production secret!
22 22 SECRET_KEY = 'xshb$k5fc-+j16)cvyffj&9u__0q3$l!hieh#+tbzqg)*f^km0'
23 23
24 24 # SECURITY WARNING: don't run with debug turned on in production!
25 25 DEBUG = True
26 26
27 27 ALLOWED_HOSTS = ['*']
28 28
29 29 CSRF_TRUSTED_ORIGINS=[
30 30 "http://*.localhost:8030"
31 31 ]
32 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 34 # Application definition
35 35
36 36 INSTALLED_APPS = [
37 37 'django.contrib.admin',
38 38 'django.contrib.auth',
39 39 'django.contrib.contenttypes',
40 40 'django.contrib.sessions',
41 41 'django.contrib.messages',
42 42 'django.contrib.staticfiles',
43 43 'apps.accounts',
44 44 'apps.main',
45 45 'apps.misc',
46 46 'apps.rc',
47 47 'apps.dds',
48 48 'apps.jars',
49 49 'apps.usrp',
50 50 'apps.abs',
51 51 'apps.cgs',
52 52 'apps.dds_rest',
53 53 "django_bootstrap5",
54 54 'polymorphic',
55 55 ]
56 56
57 57 MIDDLEWARE = [
58 58 'django.middleware.security.SecurityMiddleware',
59 59 'django.contrib.sessions.middleware.SessionMiddleware',
60 60 'django.middleware.common.CommonMiddleware',
61 61 'django.middleware.csrf.CsrfViewMiddleware',
62 62 'django.contrib.auth.middleware.AuthenticationMiddleware',
63 63 'django.contrib.messages.middleware.MessageMiddleware',
64 64 'django.middleware.clickjacking.XFrameOptionsMiddleware',
65 65
66 66 ]
67 67
68 68 ROOT_URLCONF = 'radarsys.urls'
69 69
70 70 TEMPLATES = [
71 71 {
72 72 'BACKEND': 'django.template.backends.django.DjangoTemplates',
73 73 'DIRS': [os.path.join(BASE_DIR, "templates")],
74 74 'APP_DIRS': True,
75 75 'OPTIONS': {
76 76 'context_processors': [
77 77 'django.template.context_processors.debug',
78 78 'django.template.context_processors.request',
79 79 'django.contrib.auth.context_processors.auth',
80 80 'django.contrib.messages.context_processors.messages',
81 81 'apps.main.processors.radarsys_globals',
82 82 ],
83 83 },
84 84 },
85 85 ]
86 86
87 87 WSGI_APPLICATION = 'radarsys.wsgi.application'
88
88 ASGI_APPLICATION = 'radarsys.asgi.application'
89 89
90 90 # Database
91 91 # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
92 92
93 93 DATABASES = {
94 94 # 'default': {
95 95 # 'ENGINE': 'django.db.backends.sqlite3',
96 96 # 'NAME': 'radarsys.sqlite',
97 97 # }
98 98 'default': {
99 99 'ENGINE': 'django.db.backends.postgresql_psycopg2',
100 100 'NAME': os.environ.get('DB_NAME', 'radarsys'),
101 101 'USER': os.environ.get('DB_USER', 'docker'),
102 102 'PASSWORD': os.environ.get('DB_PASSWORD', 'docker'),
103 103 'HOST': os.environ.get('POSTGRES_PORT_5432_TCP_ADDR', 'localhost'),
104 104 'PORT': os.environ.get('POSTGRES_PORT_5432_TCP_PORT', '5432'),
105 105 }
106 106 }
107 107
108 108 # Internationalization
109 109 # https://docs.djangoproject.com/en/1.8/topics/i18n/
110 110
111 111 LANGUAGE_CODE = 'en-us'
112 112
113 113 USE_TZ = False #True
114 114
115 115 TIME_ZONE = os.environ.get('TZ', 'America/Lima')
116 116
117 117 USE_I18N = True
118 118
119 119 USE_L10N = True
120 120
121 121 # Static files (CSS, JavaScript, Images)
122 122 # https://docs.djangoproject.com/en/1.8/howto/static-files/
123 123
124 124 MEDIA_URL = '/media/'
125 125 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
126 126
127 127 STATICFILES_DIRS = [
128 128 os.path.join(BASE_DIR, 'radarsys/static/')
129 129 ]
130 130
131 131 STATIC_URL = '/static/'
132 132 STATIC_ROOT = os.path.join(BASE_DIR, 'static')
133 133
134 134 LOGIN_URL = 'login'
135 135 LOGOUT_URL = 'logout'
136 136 LOGIN_REDIRECT_URL = '/admin'
137 137 LOGOUT_REDIRECT_URL = '/'
138 138
139 139 STATICFILES_FINDERS = (
140 140 'django.contrib.staticfiles.finders.FileSystemFinder',
141 141 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
142 142 )
143 143
144 144 # # Celery stuff
145 145
146 146 # REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost')
147 147 # #REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1')
148 148 # REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
149 149
150 150 # BROKER_TRANSPORT = 'redis'
151 151 # #BROKER_URL = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
152 152 # BROKER_URL = 'redis://{}:{}'.format(REDIS_HOST, REDIS_PORT)
153 153
154 154 # CELERY_RESULT_BACKEND = 'redis://{}:{}/0'.format(REDIS_HOST, REDIS_PORT)
155 155 # CELERY_BROKER_TRANSPORT = BROKER_URL
156 156 # CELERY_ACCEPT_CONTENT = ['application/json']
157 157 # CELERY_TASK_SERIALIZER = 'json'
158 158 # CELERY_RESULT_SERIALIZER = 'json'
159 159 # CELERY_ENABLE_UTC = False
160 160 # CELERY_TIMEZONE = 'America/Lima'
161 161
162 162 import django
163 163 from django.utils.encoding import force_str
164 164 django.utils.encoding.force_text = force_str
165 165
166 166 # choose of auto-created primary keys
167 167 DEFAULT_AUTO_FIELD='django.db.models.AutoField'
@@ -1,12 +1,14
1 1 Django==4.1.5
2 2 django-bootstrap5==22.2
3 3 psycopg2-binary==2.9.5
4 4 django-polymorphic==3.1
5 5 bokeh==3.0.3
6 6 numpy==1.24.1
7 7 matplotlib==3.6.3
8 8 scipy==1.10.0
9 9 celery==5.2.7
10 10 gunicorn==20.1.0
11 11 requests==2.28.2
12 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