Skip to content

Commit

Permalink
Add django environ
Browse files Browse the repository at this point in the history
  • Loading branch information
Евгений Каликов committed Dec 18, 2023
1 parent 80f7ea7 commit 0cfac3b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
11 changes: 11 additions & 0 deletions adaptive_hockey_federation/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Django settings

SECRET_KEY=12345678
DEBUG=True
ALLOWED_HOSTS=*

# Superuser settings

DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_EMAIL=admin@admin.ru
DJANGO_SUPERUSER_PASSWORD=admin
20 changes: 13 additions & 7 deletions adaptive_hockey_federation/adaptive_hockey_federation/settings.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import os
from pathlib import Path

# import environ
import environ # type: ignore

BASE_DIR = Path(__file__).resolve().parent.parent

# env = environ.Env(DEBUG=(bool, False))
env = environ.Env(DEBUG=(bool, False))

# env.read_env(BASE_DIR / '.env')
env.read_env(BASE_DIR / '.env')

# SECRET_KEY = env('SECRET_KEY')
SECRET_KEY = '12345678'
SECRET_KEY = env('SECRET_KEY')
# SECRET_KEY = '12345678'

DEBUG = True
DEBUG = env('DEBUG')
# DEBUG = True

ALLOWED_HOSTS: list = ['*']
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS')
# ALLOWED_HOSTS: list = ['*']


INSTALLED_APPS = [
Expand Down Expand Up @@ -121,3 +123,7 @@
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

AUTH_USER_MODEL = 'users.User'

DJANGO_SUPERUSER_USERNAME = env('DJANGO_SUPERUSER_USERNAME')
DJANGO_SUPERUSER_EMAIL = env('DJANGO_SUPERUSER_EMAIL')
DJANGO_SUPERUSER_PASSWORD = env('DJANGO_SUPERUSER_PASSWORD')
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.8 on 2023-12-17 23:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0002_alter_player_patronymic'),
]

operations = [
migrations.AlterField(
model_name='player',
name='patronymic',
field=models.CharField(blank=True, default='--пусто--', help_text='Отчество', max_length=256, verbose_name='Отчество'),
),
]

0 comments on commit 0cfac3b

Please sign in to comment.