diff --git a/Caddyfile b/Caddyfile
index 51e7b18..d883b6d 100644
--- a/Caddyfile
+++ b/Caddyfile
@@ -1,4 +1,4 @@
-http://ccstech.localhost
+{$DOMAIN_URL}
root * /usr/src/app/
diff --git a/Dockerfiles/django/Dockerfile b/Dockerfiles/django/Dockerfile
index c19e5f2..1c298c5 100644
--- a/Dockerfiles/django/Dockerfile
+++ b/Dockerfiles/django/Dockerfile
@@ -19,6 +19,7 @@ RUN apt install -y build-essential python3-dev libpq-dev python3-pip gettext
# install dependencies
RUN pip3 install --upgrade pip
+# install basic dependencies
COPY ./requirements.txt .
RUN pip3 install -r requirements.txt
diff --git a/app/website/admin.py b/app/website/admin.py
deleted file mode 100644
index 8c38f3f..0000000
--- a/app/website/admin.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.contrib import admin
-
-# Register your models here.
diff --git a/app/website/apps.py b/app/website/apps.py
deleted file mode 100644
index b8fd484..0000000
--- a/app/website/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class WebsiteConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'app.website'
diff --git a/app/website/migrations/__init__.py b/app/website/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/app/website/models.py b/app/website/models.py
deleted file mode 100644
index 71a8362..0000000
--- a/app/website/models.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.db import models
-
-# Create your models here.
diff --git a/app/website/templates/home.html b/app/website/templates/home.html
deleted file mode 100644
index 15f747a..0000000
--- a/app/website/templates/home.html
+++ /dev/null
@@ -1 +0,0 @@
-
Hi
\ No newline at end of file
diff --git a/app/website/tests.py b/app/website/tests.py
deleted file mode 100644
index 7ce503c..0000000
--- a/app/website/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/app/website/views.py b/app/website/views.py
deleted file mode 100644
index 35fb3dc..0000000
--- a/app/website/views.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from django.shortcuts import render
-
-# Create your views here.
-def home(request):
- return render(request, 'home.html')
\ No newline at end of file
diff --git a/ccstech/__init__.py b/ccstech/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/ccstech/wsgi.py b/ccstech/wsgi.py
deleted file mode 100644
index 08b6afb..0000000
--- a/ccstech/wsgi.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-WSGI config for ccstech 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/4.0/howto/deployment/wsgi/
-"""
-
-import os
-
-from django.core.wsgi import get_wsgi_application
-
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ccstech.settings')
-
-application = get_wsgi_application()
diff --git a/app/website/__init__.py b/core/__init__.py
similarity index 100%
rename from app/website/__init__.py
rename to core/__init__.py
diff --git a/ccstech/asgi.py b/core/asgi.py
similarity index 100%
rename from ccstech/asgi.py
rename to core/asgi.py
diff --git a/ccstech/settings.py b/core/settings.py
similarity index 98%
rename from ccstech/settings.py
rename to core/settings.py
index aedd0ff..2e710aa 100644
--- a/ccstech/settings.py
+++ b/core/settings.py
@@ -42,7 +42,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
- 'app.website',
+ 'rest_framework',
]
MIDDLEWARE = [
@@ -55,7 +55,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
-ROOT_URLCONF = 'ccstech.urls'
+ROOT_URLCONF = 'core.urls'
TEMPLATES = [
{
diff --git a/ccstech/urls.py b/core/urls.py
similarity index 100%
rename from ccstech/urls.py
rename to core/urls.py
diff --git a/django-launcher.sh b/django-launcher.sh
index 990988f..7eb6bec 100644
--- a/django-launcher.sh
+++ b/django-launcher.sh
@@ -12,6 +12,6 @@ python3 manage.py migrate
# Start server
echo "Starting server"
## With WebSockets
-uvicorn --host 0.0.0.0 --port 8000 --reload ccstech.asgi:application
-## without WebSockets
-#gunicorn --workers=4 -b 0.0.0.0:8000 --reload ccstech.wsgi:application
+python3 manage.py runserver 0.0.0.0:8000
+#echo "*****Start server with production mode*****"
+#daphne -b 0.0.0.0 -p 8000 core.asgi:application
diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml
new file mode 100644
index 0000000..47b5b23
--- /dev/null
+++ b/docker-compose.dev.yaml
@@ -0,0 +1,82 @@
+version: '3.8'
+
+services:
+
+ postgresql:
+ image: postgres
+ container_name: ${PROJECT_NAME}-postgresql
+ restart: "no"
+ environment:
+ POSTGRES_USER: ${DB_USER}
+ POSTGRES_PASSWORD: ${DB_PASSWORD}
+ POSTGRES_DB: ${DB_NAME}
+ ports:
+ - ${DB_PORT}:5432
+
+ django:
+ build:
+ context: ./
+ dockerfile: ./Dockerfiles/django/Dockerfile
+ container_name: ${PROJECT_NAME}-django
+ restart: "no"
+ entrypoint: /django-launcher.sh
+ volumes:
+ - .:/usr/src/app/
+ environment:
+ DEBUG: "False"
+ ALLOWED_HOSTS: ${DOMAIN}
+ SECRET_KEY: ${DJANGO_SECRET_KEY}
+ DB_ENGINE: django.db.backends.postgresql
+ DB_NAME: ${DB_NAME}
+ DB_USER: ${DB_USER}
+ DB_PASSWORD: ${DB_PASSWORD}
+ DB_HOST: ${DB_HOST}
+ DB_PORT: ${DB_PORT}
+ DOMAIN: ${DOMAIN}
+ DOMAIN_URL: ${DOMAIN_URL}
+ STATIC_URL: /static/
+ STATIC_ROOT: static
+ MEDIA_URL: /media/
+ REDIS_HOST: ${REDIS_HOST}
+ REDIS_PORT: ${REDIS_PORT}
+ EMAIL_HOST: ${EMAIL_HOST}
+ EMAIL_USE_TLS: ${EMAIL_USE_TLS}
+ EMAIL_USE_SSL: ${EMAIL_USE_SSL}
+ EMAIL_PORT: ${EMAIL_PORT}
+ EMAIL_USER: ${EMAIL_USER}
+ EMAIL_PASSWORD: ${EMAIL_PASSWORD}
+ expose:
+ - 8000
+ depends_on:
+ - postgresql
+ links:
+ - redis
+
+ caddy:
+ image: caddy:alpine
+ container_name: ${PROJECT_NAME}-caddy
+ restart: "no"
+ ports:
+ - ${CADDY_PORT_ONE}:80
+ - ${CADDY_PORT_TWO}:443
+ volumes:
+ - ./Caddyfile:/etc/caddy/Caddyfile
+ - ./caddy_data:/data
+ - .:/usr/src/app/
+ depends_on:
+ - django
+
+ redis:
+ image: redis:alpine
+ container_name: ${PROJECT_NAME}-redis
+ restart: "no"
+ expose:
+ - ${REDIS_PORT}
+
+ mailhog:
+ image: mailhog/mailhog:latest
+ restart: "no"
+ expose:
+ - 1025
+ ports:
+ - ${MAILHOG_PORT}:8025
diff --git a/docker-compose.pro.yaml b/docker-compose.pro.yaml
new file mode 100644
index 0000000..596024a
--- /dev/null
+++ b/docker-compose.pro.yaml
@@ -0,0 +1,74 @@
+version: '3.8'
+
+services:
+
+ postgresql:
+ image: postgres
+ container_name: ${PROJECT_NAME}-postgresql
+ restart: always
+ environment:
+ POSTGRES_USER: ${DB_USER}
+ POSTGRES_PASSWORD: ${DB_PASSWORD}
+ POSTGRES_DB: ${DB_NAME}
+ ports:
+ - ${DB_PORT}:5432
+
+ django:
+ build:
+ context: ./
+ dockerfile: ./Dockerfiles/django/Dockerfile
+ container_name: ${PROJECT_NAME}-django
+ restart: always
+ entrypoint: /django-launcher.sh
+ volumes:
+ - .:/usr/src/app/
+ environment:
+ DEBUG: "False"
+ ALLOWED_HOSTS: ${DOMAIN}
+ SECRET_KEY: ${DJANGO_SECRET_KEY}
+ DB_ENGINE: django.db.backends.postgresql
+ DB_NAME: ${DB_NAME}
+ DB_USER: ${DB_USER}
+ DB_PASSWORD: ${DB_PASSWORD}
+ DB_HOST: ${DB_HOST}
+ DB_PORT: ${DB_PORT}
+ DOMAIN: ${DOMAIN}
+ DOMAIN_URL: ${DOMAIN_URL}
+ STATIC_URL: /static/
+ STATIC_ROOT: static
+ MEDIA_URL: /media/
+ REDIS_HOST: ${REDIS_HOST}
+ REDIS_PORT: ${REDIS_PORT}
+ EMAIL_HOST: ${EMAIL_HOST}
+ EMAIL_USE_TLS: ${EMAIL_USE_TLS}
+ EMAIL_USE_SSL: ${EMAIL_USE_SSL}
+ EMAIL_PORT: ${EMAIL_PORT}
+ EMAIL_USER: ${EMAIL_USER}
+ EMAIL_PASSWORD: ${EMAIL_PASSWORD}
+ expose:
+ - 8000
+ depends_on:
+ - postgresql
+ links:
+ - redis
+
+ caddy:
+ image: caddy:alpine
+ container_name: ${PROJECT_NAME}-caddy
+ restart: always
+ ports:
+ - ${CADDY_PORT_ONE}:80
+ - ${CADDY_PORT_TWO}:443
+ volumes:
+ - ./Caddyfile:/etc/caddy/Caddyfile
+ - ./caddy_data:/data
+ - .:/usr/src/app/
+ depends_on:
+ - django
+
+ redis:
+ image: redis:alpine
+ container_name: ${PROJECT_NAME}-redis
+ restart: always
+ expose:
+ - ${REDIS_PORT}
diff --git a/docker-compose.yaml b/docker-compose.yaml
deleted file mode 100644
index 219cb24..0000000
--- a/docker-compose.yaml
+++ /dev/null
@@ -1,75 +0,0 @@
-version: '3.8'
-
-services:
-
- postgresql:
- image: postgres
- restart: "no"
- environment:
- POSTGRES_USER: "postgres"
- POSTGRES_PASSWORD: "postgres"
- POSTGRES_DB: "ccstech"
- ports:
- - 5432:5432
-
- django:
- build:
- context: ./
- dockerfile: ./Dockerfiles/django/Dockerfile
- restart: "no"
- entrypoint: /django-launcher.sh
- volumes:
- - .:/usr/src/app/
- environment:
- DEBUG: "True"
- ALLOWED_HOSTS: "ccstech.localhost"
- SECRET_KEY: "misecreto"
- DB_ENGINE: "django.db.backends.postgresql"
- DB_NAME: "ccstech"
- DB_USER: "postgres"
- DB_PASSWORD: "postgres"
- DB_HOST: "postgresql"
- DB_PORT: "5432"
- DOMAIN: "ccstech.localhost"
- DOMAIN_URL: "http://ccstech.localhost"
- STATIC_URL: "/static/"
- STATIC_ROOT: "static"
- MEDIA_URL: "/media/"
- REDIS_HOST: "redis"
- REDIS_PORT: "6379"
- EMAIL_HOST: "mailhog"
- EMAIL_USE_TLS: "False"
- EMAIL_PORT: "1025"
- EMAIL_USER: ""
- EMAIL_PASSWORD: ""
- expose:
- - 8000
- depends_on:
- - postgresql
-
- caddy:
- image: caddy:alpine
- restart: "no"
- ports:
- - 80:80
- - 443:443
- volumes:
- - ./Caddyfile:/etc/caddy/Caddyfile
- - ./caddy_data:/data
- - .:/usr/src/app/
- depends_on:
- - django
-
- redis:
- image: redis:alpine
- restart: "no"
- expose:
- - 6379
-
- mailhog:
- image: mailhog/mailhog:latest
- restart: "no"
- expose:
- - 1025
- ports:
- - 8025:8025
diff --git a/requirements.txt b/requirements.txt
index 2548d31..406a540 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,18 +1,18 @@
# Django
-django===4.0.5
-django-extensions===3.1.5
+django===4.0.6
+django-extensions===3.2.0
# PostgreSQL driver
psycopg2-binary===2.9.3
-# Servidor para Django sin Websockets
-gunicorn===20.1.0
-# Servidor para Django con Websockets
-uvicorn===0.18.1
-websockets===10.3
-# Channels
-channels==3.0.5
+# Check connection
+redis==4.3.4
+# Django Server
+daphne===3.0.2
asgiref===3.5.2
-# Conector de Redis para Channels
-channels_redis===3.4.0
-# Template
-# Pillow
-Pillow===9.1.1
\ No newline at end of file
+
+# Templates
+## Image processing
+Pillow===9.2.0
+
+# Testing
+pytest==7.1.2
+pytest-django==4.5.2