Skip to content

Commit

Permalink
Merge pull request #27 from akirachix/dev
Browse files Browse the repository at this point in the history
Dev to staging
  • Loading branch information
Ndichu-shee authored Sep 23, 2024
2 parents 6feb537 + 5ec498f commit fee4251
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
1 change: 0 additions & 1 deletion api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
router = DefaultRouter()
router.register(r"notifications", NotificationViewSet)
urlpatterns = router.urls

urlpatterns = [
path("", include(router.urls)),
path("users/", UserListView.as_view(), name="user-list"),
Expand Down
19 changes: 13 additions & 6 deletions aquasens/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import dj_database_url

"""
Django settings for newproject project.
Expand All @@ -14,7 +16,7 @@
import os
from pathlib import Path
from dotenv import load_dotenv, find_dotenv
from pathlib import Path


BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATE_DIR = os.path.join(BASE_DIR, "drainage", "templates")
Expand All @@ -41,20 +43,24 @@
"sensor",
"notification",
"corsheaders",
"django_extensions",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
]

CORS_ORIGIN_ALLOW_ALL = True


ROOT_URLCONF = "aquasens.urls"

REST_FRAMEWORK = {
Expand Down Expand Up @@ -96,11 +102,12 @@
# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

import os
import dj_database_url

DATABASES = {"default": dj_database_url.config(default=os.getenv("DATABASE_URL"))}
if not os.getenv("DATABASE_URL"):
DATABASE_URL = os.getenv("DATABASE_URL")

if DATABASE_URL:
DATABASES = {"default": dj_database_url.config(default=DATABASE_URL)}
else:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ gunicorn==23.0.0
typing_extensions==4.12.2
urllib3==2.2.3
whitenoise==6.7.0
django-extensions==3.2.3

0 comments on commit fee4251

Please sign in to comment.