Skip to content

Commit

Permalink
full commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RustamovAkrom committed Nov 12, 2024
1 parent 48b5218 commit 64226f6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
14 changes: 7 additions & 7 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ DJANGO_SETTINGS_MODULE=core.settings.development # default
PRIVATE_KEY_PATH=security_settings/private_key.pem
PUBLIC_KEY_PATH=security_settings/public_key.pem

#### Django database environs sqlite, postgres ####
DATABASE_ENVIRON=sqlite
#### Django database environs sqlite3, postgres, mysql ####
DATABASE_ENVIRON=sqlite3

#### PostgreSQL configurations ####
POSTGRES_NAME=POSTGRES_NAME
POSTGRES_USER=POSTGRES_USER
POSTGRES_PASSWORD=POSTGRES_PASSWORD
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
DATABASE_NAME=POSTGRES_NAME
DATABASE_USER=POSTGRES_USER
DATABASE_PASSWORD=POSTGRES_PASSWORD
DATABASE_HOST=localhost
DATABASE_PORT=5432


#### Django Admin param ####
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ PUBLIC_KEY_PATH=security_settings/public_key.pem # default
DATABASE_ENVIRON=sqlite # sqlite or postgres

# PostgreSQL configruations
POSTGRES_NAME=<your database name>
POSTGRES_USER=<your database user>
POSTGRES_PASSWORD=<your database password>
POSTGRES_HOST=localhost # default
POSTGRES_PORT=5432 # default
DATABASE_NAME=<your database name>
DATABASE_USER=<your database user>
DATABASE_PASSWORD=<your database password>
DATABASE_HOST=localhost # default
DATABASE_PORT=5432 # default

ADMIN_USERNAME=admin # default
ADMIN_PASSWORD=password # default
Expand Down
8 changes: 0 additions & 8 deletions core/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@

WSGI_APPLICATION = "core.wsgi.application"

DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}


AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
Expand Down
9 changes: 9 additions & 0 deletions core/settings/development.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

from .base import * # noqa

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

DATABASES = {
"default": {
"ENGINE": f"django.db.backends.{str(os.getenv('DATABASE_ENVIRON'))}",
"NAME": BASE_DIR / "db.sqlite3",
}
}
12 changes: 6 additions & 6 deletions core/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": str(os.getenv("POSTGRES_NAME")),
"USER": str(os.getenv("POSTGRES_USER")),
"PASSWORD": str(os.getenv("POSTGRES_PASSWORD")),
"HOST": str(os.getenv("POSTGRES_HOST")),
"PORT": int(os.getenv("POSTGRES_PORT"))
"ENGINE": f"django.db.backends.{str(os.getenv('DATABASE_ENVIRON'))}",
"NAME": str(os.getenv("DATABASE_NAME")),
"USER": str(os.getenv("DATABASE_USER")),
"PASSWORD": str(os.getenv("DATABASE_PASSWORD")),
"HOST": str(os.getenv("DATABASE_HOST")),
"PORT": int(os.getenv("DATABASE_PORT"))
}
}

Expand Down

0 comments on commit 64226f6

Please sign in to comment.