Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ed0803d
Revert "Separating settings configs"
himanshu272 Dec 23, 2019
79e5a59
add separate settings for development environment
realsdx Dec 23, 2019
852987f
added timer
rohitsh16 Jan 24, 2020
c8ed942
fix minor issue
rohitsh16 Jan 24, 2020
4b47694
added audio
deadlycoder07 Nov 22, 2020
6bf12da
added images and audio feature
deadlycoder07 Nov 28, 2020
57b8b14
Merge pull request #3 from deadlycoder07/master
rohitsh16 Nov 28, 2020
11dc5df
fixed small issue
deadlycoder07 Nov 29, 2020
5e5ab36
static update
deadlycoder07 Dec 12, 2020
2d01edb
Merge pull request #4 from deadlycoder07/master
deadlycoder07 Dec 12, 2020
eed0dae
Update urls.py
deadlycoder07 Dec 12, 2020
ba91f96
Update settings.py
deadlycoder07 Dec 12, 2020
4dad3fa
getscore by user:
deadlycoder07 Dec 15, 2020
20b11cc
Merge pull request #5 from deadlycoder07/master
deadlycoder07 Dec 15, 2020
841857b
getscore by user:
deadlycoder07 Dec 15, 2020
0f5a2e4
error fix
deadlycoder07 Dec 15, 2020
aaf6d81
Merge pull request #6 from deadlycoder07/master
deadlycoder07 Dec 15, 2020
4646b7a
user fix;
deadlycoder07 Dec 15, 2020
c526fff
Merge pull request #7 from deadlycoder07/master
deadlycoder07 Dec 15, 2020
a8a8aba
github login
deadlycoder07 Dec 15, 2020
7895508
github login fix
deadlycoder07 Dec 15, 2020
3c35d4f
github error fix
deadlycoder07 Dec 15, 2020
9e4ed45
github error fix
deadlycoder07 Dec 15, 2020
42df471
github error fix
deadlycoder07 Dec 15, 2020
40d6770
github error fix
deadlycoder07 Dec 15, 2020
6fc24cd
github error fix
deadlycoder07 Dec 15, 2020
9468f86
github error fix
deadlycoder07 Dec 15, 2020
8f91c01
github oauth
deadlycoder07 Dec 15, 2020
82e426a
Bump django from 2.2.4 to 2.2.13
dependabot[bot] Dec 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.env
/env
env
#VS Code
.vscode/
settings.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
"""
Django settings for Digital_Fortress_Backend project.

Generated by 'django-admin startproject' using Django 2.2.1.

For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

import os
from decouple import config, Csv
from datetime import timedelta
from rest_framework.settings import api_settings

BASE_DIR = os.path.dirname(os.path.dirname(
os.path.dirname(os.path.abspath(__file__))))
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', cast=bool)

ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv())
GOOGLE_MAPS_API_KEY = config('GOOGLE_MAPS_API_KEY')


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
Expand Down Expand Up @@ -55,6 +79,30 @@
WSGI_APPLICATION = 'Digital_Fortress_Backend.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': config('DB_NAME'),
# 'USER': config('DB_USER'),
# 'PASSWORD': config('DB_PASSWORD'),
# 'HOST': config('DB_HOST'),
# 'PORT': config('DB_PORT'),
# }
# }

# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
Expand Down Expand Up @@ -91,6 +139,9 @@
'EXPIRY_DATETIME_FORMAT': api_settings.DATETIME_FORMAT,
}

# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Kolkata'
Expand All @@ -101,7 +152,18 @@

USE_TZ = True

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_WHITELIST = [
'http://localhost:3030',
]
CORS_ORIGIN_REGEX_WHITELIST = [
'http://localhost:3030',
]
187 changes: 187 additions & 0 deletions Digital_Fortress_Backend/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
"""
Django settings for Digital_Fortress_Backend project.

Generated by 'django-admin startproject' using Django 2.2.1.

For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

import os
from decouple import config, Csv
from datetime import timedelta
from rest_framework.settings import api_settings

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG',default=False, cast=bool)

ALLOWED_HOSTS = ["*"]
#ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv())

GOOGLE_MAPS_API_KEY = config('GOOGLE_MAPS_API_KEY')


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Quiz',
'corsheaders',
'rest_framework',
'knox',
]

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

ROOT_URLCONF = 'Digital_Fortress_Backend.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'Digital_Fortress_Backend.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

if DEBUG:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
else :
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config('DB_NAME'),
'USER': config('DB_USER'),
'PASSWORD': config('DB_PASSWORD'),
'HOST': 'localhost',
'PORT': '',
}
}

# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

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',
},
]

REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
],
'DEFAULT_AUTHENTICATION_CLASSES': [
'knox.auth.TokenAuthentication',
]
}

REST_KNOX = {
'SECURE_HASH_ALGORITHM': 'cryptography.hazmat.primitives.hashes.SHA512',
'AUTH_TOKEN_CHARACTER_LENGTH': 64,
'TOKEN_TTL': timedelta(hours=72),
'USER_SERIALIZER': 'knox.serializers.UserSerializer',
'TOKEN_LIMIT_PER_USER': None,
'AUTO_REFRESH': False,
'EXPIRY_DATETIME_FORMAT': api_settings.DATETIME_FORMAT,
}

# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Kolkata'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL='/media/'
MEDIA_ROOT=os.path.join(BASE_DIR,'media')

#CORS_ALLOW_CREDENTIALS = True

CORS_ORIGIN_ALLOW_ALL = True

#CORS_ALLOW_CREDENTIALS = True

'''
CSRF_TRUSTED_ORIGINS = ['dfapi.weblikate.com','localhost:8000','localhost:5000','digitalfortress-frontend.vercel.app']
'''
CSRF_COOKIE_DOMAIN= 'dfapi.weblikate.com'
'''
CORS_ORIGIN_WHITELIST = [
'localhost:8000','localhost:5000','dfapi.weblikate.com','digitalfortress-frontend.vercel.app'
]
'''
'''
CORS_ORIGIN_REGEX_WHITELIST = [
'http://localhost:8000','http://localhost:5000','https://dfapi.weblikate.com',
]
'''
1 change: 0 additions & 1 deletion Digital_Fortress_Backend/settings/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions Digital_Fortress_Backend/settings/development.py

This file was deleted.

19 changes: 0 additions & 19 deletions Digital_Fortress_Backend/settings/production.py

This file was deleted.

7 changes: 5 additions & 2 deletions Digital_Fortress_Backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"""
from django.contrib import admin
from django.urls import path, include

from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('quiz/', include('Quiz.urls'))
]
]+ static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)


3 changes: 2 additions & 1 deletion Quiz/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin
# Register your models here.
from .models import Round, Clue, Player, Location
from .models import Round, Clue, Player, Location, duration
from django.conf import settings


Expand Down Expand Up @@ -42,3 +42,4 @@ def clear_all_values(self, req, queryset):
admin.site.register(Round)
admin.site.register(Player, PlayerAdmin)
admin.site.register(Location, LocationAdmin)
admin.site.register(duration)
22 changes: 22 additions & 0 deletions Quiz/migrations/0004_duration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 2.2.4 on 2020-01-24 10:42

import datetime
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('Quiz', '0003_auto_20191222_2004'),
]

operations = [
migrations.CreateModel(
name='duration',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('start_time', models.DateTimeField(default=datetime.datetime.now)),
('end_time', models.DateTimeField(default=datetime.datetime.now)),
],
),
]
Loading