fix names
fix names
This commit is contained in:
parent
e51406e31a
commit
128271411d
23
Makefile
23
Makefile
@ -9,9 +9,9 @@ format: ## Format style with black
|
|||||||
black --exclude="/(postgres|venv|migrations|\.git)/" .
|
black --exclude="/(postgres|venv|migrations|\.git)/" .
|
||||||
|
|
||||||
docker.recreate.django: ## Recreate Django image
|
docker.recreate.django: ## Recreate Django image
|
||||||
docker-compose -f docker-compose.yaml build --no-cache --force-rm django
|
docker-compose -f docker-compose.dev.yaml build --no-cache --force-rm django
|
||||||
docker-compose -f docker-compose.yaml up --force-recreate --no-deps -d django
|
docker-compose -f docker-compose.dev.yaml up --force-recreate --no-deps -d django
|
||||||
make run.loaddata
|
## make run.loaddata
|
||||||
|
|
||||||
run.makemigrations: ## Makemigrations
|
run.makemigrations: ## Makemigrations
|
||||||
docker-compose -f docker-compose.yaml exec -T django bash -c "python3 manage.py makemigrations"
|
docker-compose -f docker-compose.yaml exec -T django bash -c "python3 manage.py makemigrations"
|
||||||
@ -21,18 +21,19 @@ run.migrate: ## Migrate
|
|||||||
|
|
||||||
run.loaddata: ## Load initial data
|
run.loaddata: ## Load initial data
|
||||||
# Remove database
|
# Remove database
|
||||||
rm -rf database.sqlite
|
docker-compose exec -T django bash -c "python3 manage.py flush --noinput"
|
||||||
# Remove media
|
# Remove media
|
||||||
rm -rf media
|
sudo rm -rf media/categories/*
|
||||||
# Migrate
|
# Migrate
|
||||||
docker-compose -f docker-compose.yaml exec -T django bash -c "python3 manage.py migrate"
|
docker-compose exec -T django bash -c "python3 manage.py migrate"
|
||||||
|
|
||||||
run.loaddata.test: ## Load initial data test
|
run.loaddata.test: ## Load initial data test
|
||||||
make run.loaddata
|
make run.loaddata
|
||||||
# Add superuser: alias "admin" - password "admin"
|
# Add superuser: alias "admin" - password "admin"
|
||||||
docker-compose -f docker-compose.yaml exec -T django bash -c "cat data/create_superuser.py | python3 manage.py shell"
|
docker-compose -f docker-compose.dev.yaml exec -T django bash -c "cat data/create_superuser.py | python3 manage.py shell"
|
||||||
# Add more users: alias random - password "password"
|
|
||||||
docker-compose -f docker-compose.yaml exec -T django bash -c "cat data/create_users.py | python3 manage.py shell"
|
|
||||||
|
|
||||||
run.server: ## Run server
|
run.server.dev: ## Run server
|
||||||
docker-compose -f docker-compose.yaml up
|
docker-compose -f docker-compose.dev.yaml up
|
||||||
|
|
||||||
|
run.server.pro: ## Run server
|
||||||
|
docker-compose -f docker-compose.pro.yaml up
|
||||||
|
54
README.md
54
README.md
@ -8,7 +8,7 @@ make run.server
|
|||||||
|
|
||||||
Now open:
|
Now open:
|
||||||
|
|
||||||
`http://ccstech.localhost`
|
`http://template.localhost`
|
||||||
|
|
||||||
## Gulp
|
## Gulp
|
||||||
|
|
||||||
@ -68,15 +68,15 @@ make run.loaddata.test
|
|||||||
|
|
||||||
## Other domains
|
## Other domains
|
||||||
|
|
||||||
- Caddy: `http://ccstech.localhost`.
|
- Caddy: `http://template.localhost`.
|
||||||
- Gulp: `http://ccstech.localhost:3000`.
|
- Gulp: `http://template.localhost:3000`.
|
||||||
- Django: `http://ccstech.localhost:8000`.
|
- Django: `http://template.localhost:8000`.
|
||||||
- Mailhog: `http://ccstech.localhost:8025`.
|
- Mailhog: `http://template.localhost:8025`.
|
||||||
|
|
||||||
### Bash Django
|
### Bash Django
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
docker exec -it ccstech_django_1 bash
|
docker exec -it template-django bash
|
||||||
```
|
```
|
||||||
|
|
||||||
# Run production
|
# Run production
|
||||||
@ -85,4 +85,44 @@ docker exec -it ccstech_django_1 bash
|
|||||||
docker-compose -f docker-compose.pro.yaml up
|
docker-compose -f docker-compose.pro.yaml up
|
||||||
```
|
```
|
||||||
|
|
||||||
Open `https://ccstech.io`.
|
Open `https://template.io`.
|
||||||
|
|
||||||
|
# Enviroment (.env)
|
||||||
|
```text
|
||||||
|
PROJECT_NAME=template
|
||||||
|
|
||||||
|
# Domain
|
||||||
|
DOMAIN=template.localhost
|
||||||
|
DOMAIN_URL=http://template.localhost
|
||||||
|
|
||||||
|
# Database
|
||||||
|
DB_NAME=template_db
|
||||||
|
DB_USER=postgres
|
||||||
|
DB_PASSWORD=postgres
|
||||||
|
DB_HOST=postgresql
|
||||||
|
DB_PORT=5432
|
||||||
|
|
||||||
|
# Django options
|
||||||
|
DJANGO_SECRET_KEY=mysecret
|
||||||
|
|
||||||
|
# Redis
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
# Caddy
|
||||||
|
CADDY_PORT_ONE=80
|
||||||
|
CADDY_PORT_TWO=443
|
||||||
|
|
||||||
|
# Email
|
||||||
|
DEFAULT_FROM_EMAIL=no-reply@template.localhost
|
||||||
|
EMAIL_CONTACT=info@template.localhost
|
||||||
|
EMAIL_HOST=mailhog
|
||||||
|
EMAIL_USER=
|
||||||
|
EMAIL_PASSWORD=
|
||||||
|
EMAIL_PORT=1025
|
||||||
|
EMAIL_USE_TLS=False
|
||||||
|
EMAIL_USE_SSL=False
|
||||||
|
|
||||||
|
# Mailhog
|
||||||
|
MAILHOG_PORT=8025
|
||||||
|
```
|
@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
ASGI config for ccstech project.
|
ASGI config for core project.
|
||||||
|
|
||||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
@ -11,6 +11,6 @@ import os
|
|||||||
|
|
||||||
from django.core.asgi import get_asgi_application
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ccstech.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||||
|
|
||||||
application = get_asgi_application()
|
application = get_asgi_application()
|
||||||
|
@ -10,6 +10,7 @@ For the full list of settings and their values, see
|
|||||||
https://docs.djangoproject.com/en/3.2/ref/settings/
|
https://docs.djangoproject.com/en/3.2/ref/settings/
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import dj_database_url
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from django.db.backends.signals import connection_created
|
from django.db.backends.signals import connection_created
|
||||||
|
|
||||||
@ -78,14 +79,7 @@ TEMPLATES = [
|
|||||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": dj_database_url.config(default=f"postgres://{os.environ.get('DB_USER')}:{os.environ.get('DB_PASSWORD')}@{os.environ.get('DB_HOST')}:{os.environ.get('DB_PORT')}/{os.environ.get('DB_NAME')}")
|
||||||
"ENGINE": os.environ.get("DB_ENGINE"),
|
|
||||||
"NAME": os.environ.get("DB_NAME"),
|
|
||||||
"USER": os.environ.get("DB_USER"),
|
|
||||||
"PASSWORD": os.environ.get("DB_PASSWORD"),
|
|
||||||
"HOST": os.environ.get("DB_HOST"),
|
|
||||||
"PORT": os.environ.get("DB_PORT"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""ccstech URL Configuration
|
"""template URL Configuration
|
||||||
|
|
||||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
https://docs.djangoproject.com/en/4.0/topics/http/urls/
|
https://docs.djangoproject.com/en/4.0/topics/http/urls/
|
||||||
@ -15,9 +15,7 @@ Including another URLconf
|
|||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from app.website import views as website_views
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', website_views.home, name='home'),
|
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
@ -75,6 +75,7 @@ services:
|
|||||||
|
|
||||||
mailhog:
|
mailhog:
|
||||||
image: mailhog/mailhog:latest
|
image: mailhog/mailhog:latest
|
||||||
|
container_name: ${PROJECT_NAME}-mailhog
|
||||||
restart: "no"
|
restart: "no"
|
||||||
expose:
|
expose:
|
||||||
- 1025
|
- 1025
|
||||||
|
@ -6,7 +6,7 @@ import sys
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ccstech.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
# Django
|
# Django
|
||||||
django===4.0.6
|
django===4.0.6
|
||||||
django-extensions===3.2.0
|
django-extensions===3.2.0
|
||||||
|
dj-database-url==0.5.0
|
||||||
|
|
||||||
|
# Django REST
|
||||||
|
djangorestframework==3.13.1
|
||||||
|
django-cors-headers==3.10.0
|
||||||
|
|
||||||
# PostgreSQL driver
|
# PostgreSQL driver
|
||||||
psycopg2-binary===2.9.3
|
psycopg2-binary===2.9.3
|
||||||
|
|
||||||
# Check connection
|
# Check connection
|
||||||
redis==4.3.4
|
redis==4.3.4
|
||||||
|
|
||||||
# Django Server
|
# Django Server
|
||||||
daphne===3.0.2
|
daphne===3.0.2
|
||||||
asgiref===3.5.2
|
asgiref===3.5.2
|
||||||
@ -16,3 +24,8 @@ Pillow===9.2.0
|
|||||||
# Testing
|
# Testing
|
||||||
pytest==7.1.2
|
pytest==7.1.2
|
||||||
pytest-django==4.5.2
|
pytest-django==4.5.2
|
||||||
|
|
||||||
|
# Quality code
|
||||||
|
black==22.6.0
|
||||||
|
flake8==4.0.1
|
||||||
|
isort==5.10.1
|
Loading…
Reference in New Issue
Block a user