-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (99 loc) · 2.79 KB
/
Copy pathMakefile
File metadata and controls
129 lines (99 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
.PHONY: install migrate seed test run docker-build docker-up docker-down clean setup
# Python and Django commands
install:
pip install --upgrade pip
pip install -r requirements.txt
migrate:
python manage.py makemigrations
python manage.py migrate
superuser:
python manage.py create_admin --email=admin@certifynow.uz --password=admin123
seed:
python manage.py generate_certificates --count=50
test:
python manage.py test --verbosity=2
run:
python manage.py runserver 0.0.0.0:8000
collectstatic:
python manage.py collectstatic --noinput --clear
shell:
python manage.py shell_plus
# Docker commands
docker-build:
docker-compose build --no-cache
docker-up:
docker-compose up -d
docker-down:
docker-compose down -v
docker-logs:
docker-compose logs -f
docker-restart:
docker-compose restart
docker-clean:
docker-compose down -v --rmi all --remove-orphans
docker system prune -f
# Development setup
setup: install migrate superuser seed
@echo "✅ Development environment setup complete!"
@echo "🚀 Run 'make run' to start the server"
@echo "📚 API docs: http://localhost:8000/api/docs/"
@echo "👤 Admin: admin@certifynow.uz / admin123"
# Production setup
prod-setup: install collectstatic migrate
@echo "✅ Production environment setup complete!"
# Database operations
db-reset:
python manage.py flush --noinput
python manage.py migrate
python manage.py create_admin --email=admin@certifynow.uz --password=admin123
db-backup:
python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e auth.Permission > backup.json
db-restore:
python manage.py loaddata backup.json
# Code quality
lint:
flake8 .
black --check .
isort --check-only .
format:
black .
isort .
# Testing
test-coverage:
coverage run --source='.' manage.py test
coverage report
coverage html
# Clean up
clean:
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type f -name "*.log" -delete
# API documentation
docs:
python manage.py spectacular --color --file schema.yml
@echo "📄 API schema generated at schema.yml"
# Security check
security:
python manage.py check --deploy
safety check
# Performance monitoring
monitor:
python manage.py runserver_plus --print-sql
# Celery commands
celery-worker:
celery -A certifynow worker -l info
celery-beat:
celery -A certifynow beat -l info
celery-flower:
celery -A certifynow flower
# Help
help:
@echo "Available commands:"
@echo " setup - Complete development setup"
@echo " run - Run development server"
@echo " test - Run tests"
@echo " docker-up - Start with Docker"
@echo " clean - Clean temporary files"
@echo " docs - Generate API documentation"
@echo " help - Show this help"