Skip to content

Commit

Permalink
add dj_database_url
Browse files Browse the repository at this point in the history
  • Loading branch information
prStudentka committed Mar 1, 2024
1 parent 22c3f1a commit ad02372
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
17 changes: 16 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ python-dotenv = "^1.0.0"
psycopg2-binary = "^2.9.9"
django-filter = "^23.5"
rollbar = "0.16.3"
dj-database-url = "^2.1.0"


[tool.poetry.group.dev.dependencies]
Expand Down
40 changes: 23 additions & 17 deletions task_manager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import os
import dj_database_url
from urllib.parse import urlparse
from pathlib import Path
from dotenv import load_dotenv
Expand Down Expand Up @@ -92,6 +93,13 @@

# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': dj_database_url.config(
default=os.getenv('DATABASE_URL'),
conn_max_age=600),
}

'''
DB_URL = os.getenv('DATABASE_URL')
parsed_url = urlparse(DB_URL)
DATABASES = {
Expand All @@ -109,7 +117,7 @@
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}

'''

# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
Expand All @@ -122,24 +130,22 @@
}
},
]
'''
AUTH_PASSWORD_VALIDATORS = [

{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
#AUTH_PASSWORD_VALIDATORS = [
# {
# 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
# },
# {
# 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
# },
#]

]
'''
AUTH_USER_MODEL = 'users.CustomUser'

# Internationalization
Expand Down

0 comments on commit ad02372

Please sign in to comment.