File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 38
38
- name : Set up Python
39
39
uses : actions/setup-python@v4
40
40
with :
41
- python-version : ' 3.10' # Используем Python 3.10, так как он совместим с Django 4.2.4
41
+ python-version : ' 3.10'
42
42
43
43
- name : Install dependencies
44
44
run : |
54
54
- name : Configure Django settings for testing
55
55
run : |
56
56
echo "Configuring Django settings for testing..."
57
- cp .env.example .env # Создаем файл окружения (если используется django-environ)
58
- sed -i 's/DATABASE_URL=.*$/DATABASE_URL=postgres:\/\/postgres:postgres@localhost:5432\/testdb/' .env
59
- export $(grep -v '^#' .env | xargs) # Импортируем переменные окружения
57
+ # Создаем файл .env, если он не существует
58
+ if [ ! -f ".env" ]; then
59
+ echo "Creating .env file for testing..."
60
+ cat <<-EOF > .env
61
+ DEBUG=True
62
+ SECRET_KEY=your_secret_key_for_testing
63
+ DATABASE_URL=postgres://postgres:postgres@localhost:5432/testdb
64
+ EOF
65
+ fi
66
+ # Импортируем переменные окружения из .env
67
+ export $(grep -v '^#' .env | xargs)
60
68
61
69
- name : Run database migrations
62
70
run : |
71
79
run : |
72
80
if command -v python manage.py &>/dev/null; then
73
81
echo "Collecting static files..."
74
- python manage.py collectstatic --noinput
82
+ python manage.py collectstatic --noinput --clear
75
83
else
76
84
echo "manage.py not found. Skipping static collection."
77
85
fi
You can’t perform that action at this time.
0 commit comments