problem when start django with gunicorn, how to fix it?How do I define a settings.LOGGING so that gunicorn will find the version value it wants?RuntimeWarning: DateTimeField received a naive datetimeError: The 'elasticsearch' backend requires the installation of 'requests'. How do I fix it?Error loading Mysqldb module in Python DjangoHow can I get an old Django project back and running like it was before?Django Issue: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yetAttributeError: 'module' object has no attribute 'face' even after installed opencv-contrib-pythonPython 3 Django on App Engine Standard: App Fails to StartDjango Showing Error while running manage.py filePython Django Mysql Expected in: flat namespace
Dropping outliers based on "2.5 times the RMSE"
Assistant professor does not collaborate with or cite fellow department members, despite them being experts on the topic
As a DM, how to avoid unconscious metagaming when dealing with a high AC character?
How does one stock fund's charge of 1% more in operating expenses than another fund lower expected returns by 10%?
What is temperature on a quantum level?
Conciousness in Buddhism and Advaita Vedanta
Too many spies!
Is this floating-point optimization allowed?
What would the EU do if an EU member declared war on another EU member?
Is `curl something | sudo bash -` a reasonably safe installation method?
Redefining hyperref in document referencing
Redirecting of hostname to full qualified domain name with HTTPS fails
How can one write good dialogue in a story without sounding wooden?
Alternatives to using writing paper for writing practice
Password maker in C#
Trying to find a flaw in my proof that there are more rearrangements of an infinite series than real numbers
nmcheck.gnome.org facilitating ads?
Fix /dev/sdb after using dd with no device inserted
Am I testing diodes properly?
Can "candidate" be used as a verb?
Can I intentionally omit previous work experience or pretend it doesn't exist when applying for jobs?
What does [Item]やったらなんでも売ってる mean?
How to convert 1k to 1000 and 1m to 1000000 in Excel
Are randomly-generated passwords starting with "a" less secure?
problem when start django with gunicorn, how to fix it?
How do I define a settings.LOGGING so that gunicorn will find the version value it wants?RuntimeWarning: DateTimeField received a naive datetimeError: The 'elasticsearch' backend requires the installation of 'requests'. How do I fix it?Error loading Mysqldb module in Python DjangoHow can I get an old Django project back and running like it was before?Django Issue: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yetAttributeError: 'module' object has no attribute 'face' even after installed opencv-contrib-pythonPython 3 Django on App Engine Standard: App Fails to StartDjango Showing Error while running manage.py filePython Django Mysql Expected in: flat namespace
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I tried running my project using Gunicorn with the command gunicorn --bind 0.0.0.0:8000 myproject.wsgi:application, but the result was an error and gunicorn cancelled the boot.
gunicorn --bind 0.0.0.0:8000 core.wsgi:application
[2019-03-26 10:55:16 +0000] [8560] [INFO] Starting gunicorn 19.9.0
[2019-03-26 10:55:16 +0000] [8560] [INFO] Listening at: http://0.0.0.0:8000 (8560)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Using worker: sync
[2019-03-26 10:55:16 +0000] [8565] [INFO] Booting worker with pid: 8565
[2019-03-26 10:55:16 +0000] [8565] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/home/rofi/demo.protek/core/core/wsgi.py", line 16, in <module>
application = WSGIHandler()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 4, in <module>
from django.contrib.auth.backends import RemoteUserBackend
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/backends.py", line 4, in <module>
from django.contrib.auth.models import Permission
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/db/models/base.py", line 110, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 247, in get_containing_app_config
self.check_apps_ready()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 125, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
AppRegistryNotReady: Apps aren't loaded yet.
[2019-03-26 10:55:16 +0000] [8565] [INFO] Worker exiting (pid: 8565)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Shutting down: Master
[2019-03-26 10:55:16 +0000] [8560] [INFO] Reason: Worker failed to boot.
What's wrong about it? Any help to fix it?
python django postgresql nginx gunicorn
add a comment |
I tried running my project using Gunicorn with the command gunicorn --bind 0.0.0.0:8000 myproject.wsgi:application, but the result was an error and gunicorn cancelled the boot.
gunicorn --bind 0.0.0.0:8000 core.wsgi:application
[2019-03-26 10:55:16 +0000] [8560] [INFO] Starting gunicorn 19.9.0
[2019-03-26 10:55:16 +0000] [8560] [INFO] Listening at: http://0.0.0.0:8000 (8560)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Using worker: sync
[2019-03-26 10:55:16 +0000] [8565] [INFO] Booting worker with pid: 8565
[2019-03-26 10:55:16 +0000] [8565] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/home/rofi/demo.protek/core/core/wsgi.py", line 16, in <module>
application = WSGIHandler()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 4, in <module>
from django.contrib.auth.backends import RemoteUserBackend
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/backends.py", line 4, in <module>
from django.contrib.auth.models import Permission
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/db/models/base.py", line 110, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 247, in get_containing_app_config
self.check_apps_ready()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 125, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
AppRegistryNotReady: Apps aren't loaded yet.
[2019-03-26 10:55:16 +0000] [8565] [INFO] Worker exiting (pid: 8565)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Shutting down: Master
[2019-03-26 10:55:16 +0000] [8560] [INFO] Reason: Worker failed to boot.
What's wrong about it? Any help to fix it?
python django postgresql nginx gunicorn
are you able to run the development server?
– JPG
Mar 26 at 4:28
addimport django;django.setup()code at the top of/home/rofi/demo.protek/core/core/wsgi.pyfile
– Avinash Raj
Mar 26 at 5:05
Could you please share yoursettings.pyfile and what you gave to theAUTH_USER_MODEL?
– Devang Padhiyar
Mar 26 at 5:27
in my setting.pyAUTH_USER_MODEL = 'auth.User'
– Rofi Areiv
Mar 26 at 14:38
add a comment |
I tried running my project using Gunicorn with the command gunicorn --bind 0.0.0.0:8000 myproject.wsgi:application, but the result was an error and gunicorn cancelled the boot.
gunicorn --bind 0.0.0.0:8000 core.wsgi:application
[2019-03-26 10:55:16 +0000] [8560] [INFO] Starting gunicorn 19.9.0
[2019-03-26 10:55:16 +0000] [8560] [INFO] Listening at: http://0.0.0.0:8000 (8560)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Using worker: sync
[2019-03-26 10:55:16 +0000] [8565] [INFO] Booting worker with pid: 8565
[2019-03-26 10:55:16 +0000] [8565] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/home/rofi/demo.protek/core/core/wsgi.py", line 16, in <module>
application = WSGIHandler()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 4, in <module>
from django.contrib.auth.backends import RemoteUserBackend
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/backends.py", line 4, in <module>
from django.contrib.auth.models import Permission
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/db/models/base.py", line 110, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 247, in get_containing_app_config
self.check_apps_ready()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 125, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
AppRegistryNotReady: Apps aren't loaded yet.
[2019-03-26 10:55:16 +0000] [8565] [INFO] Worker exiting (pid: 8565)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Shutting down: Master
[2019-03-26 10:55:16 +0000] [8560] [INFO] Reason: Worker failed to boot.
What's wrong about it? Any help to fix it?
python django postgresql nginx gunicorn
I tried running my project using Gunicorn with the command gunicorn --bind 0.0.0.0:8000 myproject.wsgi:application, but the result was an error and gunicorn cancelled the boot.
gunicorn --bind 0.0.0.0:8000 core.wsgi:application
[2019-03-26 10:55:16 +0000] [8560] [INFO] Starting gunicorn 19.9.0
[2019-03-26 10:55:16 +0000] [8560] [INFO] Listening at: http://0.0.0.0:8000 (8560)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Using worker: sync
[2019-03-26 10:55:16 +0000] [8565] [INFO] Booting worker with pid: 8565
[2019-03-26 10:55:16 +0000] [8565] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/home/rofi/demo.protek/core/core/wsgi.py", line 16, in <module>
application = WSGIHandler()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 151, in __init__
self.load_middleware()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 4, in <module>
from django.contrib.auth.backends import RemoteUserBackend
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/backends.py", line 4, in <module>
from django.contrib.auth.models import Permission
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/db/models/base.py", line 110, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 247, in get_containing_app_config
self.check_apps_ready()
File "/home/rofi/demo.protek/lib/python2.7/site-packages/django/apps/registry.py", line 125, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
AppRegistryNotReady: Apps aren't loaded yet.
[2019-03-26 10:55:16 +0000] [8565] [INFO] Worker exiting (pid: 8565)
[2019-03-26 10:55:16 +0000] [8560] [INFO] Shutting down: Master
[2019-03-26 10:55:16 +0000] [8560] [INFO] Reason: Worker failed to boot.
What's wrong about it? Any help to fix it?
python django postgresql nginx gunicorn
python django postgresql nginx gunicorn
edited Mar 26 at 5:57
eyllanesc
101k12 gold badges37 silver badges70 bronze badges
101k12 gold badges37 silver badges70 bronze badges
asked Mar 26 at 4:24
Rofi AreivRofi Areiv
43 bronze badges
43 bronze badges
are you able to run the development server?
– JPG
Mar 26 at 4:28
addimport django;django.setup()code at the top of/home/rofi/demo.protek/core/core/wsgi.pyfile
– Avinash Raj
Mar 26 at 5:05
Could you please share yoursettings.pyfile and what you gave to theAUTH_USER_MODEL?
– Devang Padhiyar
Mar 26 at 5:27
in my setting.pyAUTH_USER_MODEL = 'auth.User'
– Rofi Areiv
Mar 26 at 14:38
add a comment |
are you able to run the development server?
– JPG
Mar 26 at 4:28
addimport django;django.setup()code at the top of/home/rofi/demo.protek/core/core/wsgi.pyfile
– Avinash Raj
Mar 26 at 5:05
Could you please share yoursettings.pyfile and what you gave to theAUTH_USER_MODEL?
– Devang Padhiyar
Mar 26 at 5:27
in my setting.pyAUTH_USER_MODEL = 'auth.User'
– Rofi Areiv
Mar 26 at 14:38
are you able to run the development server?
– JPG
Mar 26 at 4:28
are you able to run the development server?
– JPG
Mar 26 at 4:28
add
import django;django.setup() code at the top of /home/rofi/demo.protek/core/core/wsgi.py file– Avinash Raj
Mar 26 at 5:05
add
import django;django.setup() code at the top of /home/rofi/demo.protek/core/core/wsgi.py file– Avinash Raj
Mar 26 at 5:05
Could you please share your
settings.py file and what you gave to the AUTH_USER_MODEL?– Devang Padhiyar
Mar 26 at 5:27
Could you please share your
settings.py file and what you gave to the AUTH_USER_MODEL?– Devang Padhiyar
Mar 26 at 5:27
in my setting.py
AUTH_USER_MODEL = 'auth.User'– Rofi Areiv
Mar 26 at 14:38
in my setting.py
AUTH_USER_MODEL = 'auth.User'– Rofi Areiv
Mar 26 at 14:38
add a comment |
1 Answer
1
active
oldest
votes
Devang Padhiyar thanks for your answer. let see my setting.py file
import os
import datetime
from datetime import timedelta
import time
from django.utils.translation import ugettext_lazy as _
from django.conf.locale.en import formats as es_formats
from django.core.cache import cache
from django.core.validators import RegexValidator
from bs4 import BeautifulSoup
from django.urls import reverse_lazy
from easy_thumbnails.conf import Settings as thumbnail_settings
from django.core.files import File as FileWrapper
from django.shortcuts import redirect
from django.http import Http404
from django.contrib.messages import constants as message_constants
from core import get_shortcut, get_shortcut_setting
MESSAGE_LEVEL = message_constants.DEBUG
AUTH_USER_MODEL = 'auth.User'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '%h_=n$2yh554=2za0zsb%ubk!tg=e0)l@_w@ap#^d#_ew7)yig'
DEBUG = True
ALLOWED_HOSTS = ['0.0.0.0', '103.105.98.214', 'protek.id', 'demo.protek.id', 'localhost']
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
# =========================================================================================
# =========================================================================================
INSTALLED_APPS = [
'django.contrib.contenttypes',
'grappelli.dashboard',
'admin_shortcuts',
'dal',
'dal_select2',
'grappelli',
'django_admin_env_notice',
'django.contrib.admin',
'grappelli_autocomplete_fk_edit_link',
'el_pagination',
'crispy_forms', # http://django-crispy-forms.readthedocs.io/en/latest/install.html
'django_select2', # https://github.com/applegrew/django-select2
'easy_select2',
'easy_thumbnails', # https://github.com/SmileyChris/easy-thumbnails
'image_cropping',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_admin_caching',
'user_sessions', # app/user_sessions/session/
'nested_admin', # inline multiple tree
'tabbed_admin', # tabbed jquery
'watchman', # monitor status database IPADDRESS/watchman/
'django.contrib.humanize', # Money formated for HTML
'mptt', # Tree
'sorl.thumbnail', # http://django-file-picker.readthedocs.io/en/latest/
'clear_cache', # python manage.py clear_cache
'cachetable', # database Cache /app/sysconf/cachetable/
'ckeditor', # editor
'dbbackup_ui', # Bakcup Db dan media | app/backups/backup-database-and-media/
'session_security', # http://django-session-security.readthedocs.io | Ipaddress/session_security/ping/
'reversion', # VersionAdmin data model
'reversion_compare', # https://github.com/jedie/django-reversion-compare
'debug_toolbar', # https://django-debug-toolbar.readthedocs.io
'djangobower', # Pendukung debug toolbar | https://axiacore.com/blog/effective-dependency-management-django-using-bower/
# 'export_action', # Download exel disetiap table model
'import_export', # http://django-import-export.readthedocs.io
'tagging',
'smart_selects', # Berhubungan dengan popup, get dll
'bidiutils', # Context processor
'pipeline', # https://django-pipeline.readthedocs.io/en/latest/installation.html
'django_postgrespool', # Postgres Connection Pooling backend
'djangosecure',
'treewidget',
# 'sysconf',
# 'moderation', # or 'moderation.apps.ModerationConfig',,
'django_pg_current_timestamp',
'django.contrib.sitemaps',
'robots', # https://godjango.com/23-robots-and-sitemaps/
'filer', # https://django-filer.readthedocs.io/en/latest/installation.html
'autofixture', # https://pypi.org/project/django-autofixture/
'corsheaders', # https://www.techiediaries.com/django-cors/
'django_nose',
'redisboard',
'core_doc',
'crm_mstdata',
'globalmasters',
'hris',
'hris_mstdata',
'crm',
'homepage',
'product',
# 'placement',
'facultative',
'finance',
'docman',
'treaty',
]
# =========================================================================================
# =========================================================================================
# BACKEND SETUP =========================================================================
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'user_sessions.middleware.SessionMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'session_security.middleware.SessionSecurityMiddleware',
'x_forwarded_for.middleware.XForwardedForMiddleware',
'qinspect.middleware.QueryInspectMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
]
WSGI_APPLICATION = 'core.wsgi.application'
SESSION_ENGINE = 'user_sessions.backends.db'
SESSION_CACHE_ALIAS = "default"
ROOT_URLCONF = 'core.urls'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
]
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',
,
]
LOGGING =
'version': 1,
'disable_existing_loggers': False,
'handlers':
'console':
'class': 'logging.StreamHandler',
,
,
# 'loggers':
# 'django.db.backends':
# 'level': 'DEBUG',
# 'handlers': ['console'],
# ,
# 'qinspect':
# 'handlers': ['console'],
# 'level': 'DEBUG',
# 'propagate': True,
#
# ,
CACHES =
'default':
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'cachetable',
,
# CACHES =
# "default":
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/1",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient"
# ,
# "KEY_PREFIX": "brokr"
# ,
# 'select2':
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/2",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient",
#
#
#
# SELECT2_CACHE_BACKEND = 'select2'
CACHE_TTL = 60 * 15
SESSION_COOKIE_AGE = 30 * 60 # 30 Menit
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
COMPRESS = True
COMPRESS_AUTO = True
COMPRESS_VERSION = True
COMPRESS_ENABLED = True
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
# =========================================================================================
# =========================================================================================
# FRONT END SETUP =========================================================================
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS
THUMBNAIL_ALIASES =
'':
'avatar': 'size': (50, 50), 'crop': True,
,
THUMBNAIL_HIGH_RESOLUTION = True
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': False,
'OPTIONS':
'debug': DEBUG,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'bidiutils.context_processors.bidi',
'django_admin_env_notice.context_processors.from_settings',
# 'context_processors.app_list',
],
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'apptemplates.Loader',
]),
],
,
,
]
DYNAMIC_PREFERENCES =
'MANAGER_ATTRIBUTE': 'preferences',
'REGISTRY_MODULE': 'dynamic_preferences_registry',
'ADMIN_ENABLE_CHANGELIST_FORM': False,
'SECTION_KEY_SEPARATOR': '__',
'ENABLE_CACHE': True,
'VALIDATE_NAMES': True,
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
LOGIN_URL = '/login/'
ADMIN_MEDIA_PREFIX = '/media/'
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "assets"),
)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
# 'compressor.finders.CompressorFinder',
'pipeline.finders.PipelineFinder',
)
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/assets/bower_components/'
BOWER_PATH = '/usr/bin/bower'
BOWER_INSTALLED_APPS = (
'jquery',
'underscore',
'markitup#1.1.14',
'mediaelement#2.22.0',
'blueimp-file-upload#9.12.5',
)
PIPELINE =
'PIPELINE_ENABLED': True,
'JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
'CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
JS_WRAPPER = "(function()stuff();%s)();"
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_CONFIGS =
'default':
'skin': 'moono-lisa',
'toolbar': [["Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Print"],
['NumberedList', 'BulletedList', "Indent", "Outdent", 'JustifyLeft',
'JustifyCenter','JustifyRight', 'JustifyBlock'],
["Image", "Table", "Link", "Unlink", "Anchor", "SectionLink",
"Subscript", "Superscript"], ['Undo', 'Redo'], ["Source"],
["Maximize"]],
'tabSpaces': 3,
'toolbarCanCollapse': True,
'width': 880,
,
CKEDITOR_ALLOW_NONIMAGE_FILES = False
# TABBED_ADMIN_USE_JQUERY_UI = True
# TABBED_ADMIN_JQUERY_UI_CSS = 'tabbed_admin/css/tabbed_grappelli_admin.css'
# TABBED_ADMIN_JQUERY_UI_JS = 'tabbed_admin/js/jquery-ui-1.11.4.min.js'
LOGIN_REDIRECT_URL = 'home'
LOGOUT_REDIRECT_URL = '/'
UPLOADFILE = '/files/'
STATIC_DEPS = True
# TAGGIT_CASE_INSENSITIVE = True
DEFAULT_FILER_SERVERS =
'private':
'main':
'ENGINE': 'filer.server.backends.default.DefaultServer',
,
'thumbnails':
'ENGINE': 'filer.server.backends.default.DefaultServer',
# =====================================================================================
# =====================================================================================
# DATABASE SETUP ======================================================================
DATABASES =
'default':
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'core',
'USER': 'postgres',
'PASSWORD': 'Kambing1',
'HOST': 'localhost',
'PORT': '5432',
'CONN_MAX_AGE': 60 * 10, # 10 minutes
'AUTOCOMMIT': True,
SOUTH_DATABASE_ADAPTERS =
'default': 'south.db.postgresql_psycopg2'
DATABASE_POOL_ARGS =
'max_overflow': 10,
'pool_size': 5,
'recycle': 300
# =========================================================================================
# =========================================================================================
# OTHER SETUP
VARNISH_MANAGEMENT_ADDRS = ('127.0.0.1:6082',)
es_formats.DATETIME_FORMAT = "Y-m-d H:i:s"
LANGUAGE_CODE = 'en-us'
LANGUAGE_BIDI = True
TIME_ZONE = 'Asia/Jakarta'
USE_I18N = True
USE_L10N = True
USE_TZ = True
SITE_ID = 1
GOOGLE_MAPS_API_KEY = 'AIzaSyD8BxyAFUwWxv2lUnFv06ekTakzTr3sl-E'
IMPORT_EXPORT_USE_TRANSACTIONS = True
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '316233965812-sjbuqlsaat19vesjo6fa44jrlidjit7d.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'ff-pKw85dbNjYxydjM5FTRxz'
# =========================================================================================
# =========================================================================================
# SECURTY UPDATE ========================================================================
X_FRAME_OPTIONS = 'DENY'
CORS_REPLACE_HTTPS_REFERER = False
HOST_SCHEME = "http://"
SECURE_PROXY_SSL_HEADER = None
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SECURE_HSTS_SECONDS = None
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_FRAME_DENY = False
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_HSTS_PRELOAD = True
# =========================================================================================
# =========================================================================================
# EMAIL SETUP =============================================================================
EMAIL_BACKEND = 'django_multiple_email_backends.backend.CombinedEmailBackend'
EMAIL_BACKEND_LIST = ['django.core.mail.backends.filebased.EmailBackend',
'django.core.mail.backends.smtp.EmailBackend']
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'jasawarung@gmail.com'
EMAIL_HOST_PASSWORD = 'cgkxqhzuyfatucor'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
CONTACT_US_EMAIL = 'jasawarung@gmail.com'
# =========================================================================================
# =========================================================================================
# DEBUG TOOLBAR ===========================================================================
def show_toolbar(request):
return True
DEBUG_TOOLBAR_CONFIG =
"SHOW_TOOLBAR_CALLBACK" : show_toolbar,
'DISABLE_PANELS':
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
,
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
CONFIG_DEFAULTS =
'RESULTS_CACHE_SIZE': 3,
'SHOW_COLLAPSED': True,
'SQL_WARNING_THRESHOLD': 100, # milliseconds
# =========================================================================================
# =========================================================================================
# THEME SETUP ============================================================================
GRAPPELLI_INDEX_DASHBOARD = 'core.dashboard.GlobalSetting'
GRAPPELLI_ADMIN_TITLE = 'BROKR PLATFORM'
GRAPPELLI_AUTOCOMPLETE_LIMIT = 20
GRAPPELLI_CLEAN_INPUT_TYPES = True
GRAPPELLI_SWITCH_USER = False
GRAPPELLI_SWITCH_USER_ORIGINAL = True
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
SESSION_EXPIRE_SECONDS = 3600 # 1 hour
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
def itemDate():
return datetime.date.today()
ADMIN_SHORTCUTS = [
'title': 'Date Now : ' + str(itemDate()),
'shortcuts': [
'title': 'Home',
'url': '/',
,
'title': 'Treaty',
'url': '/treaty/',
'icon': 'clipboard',
# 'count_new': 'core.utils.count_submission',
,
'title': 'Facultative',
'url': '/facultative/',
'icon': 'paperclip',
# 'count_new': 'core.utils.count_submission',
,
'title': 'CRM',
'url': '/crm/',
'icon': 'address-book',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Project',
# 'url': '/placement/',
# 'icon': 'folder',
# 'count_new': 'core.utils.count_submission',
# ,
'title': 'HRD',
'url': '/hris/',
'icon': 'users',
# 'count_new': 'core.utils.count_account',
,
'title': 'Financial & Accounting',
'url': '/finance/',
'icon': 'chart-pie',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Profile',
# 'url': '/hris/employeesadmin/',
# 'icon': 'user',
# ,
]
,
]
ADMIN_SHORTCUTS_SETTINGS =
'show_on_all_pages': True,
'hide_app_list': False,
'open_new_window': False,
CRISPY_TEMPLATE_PACK = 'uni_form'
APPEND_SLASH = False
LANGUAGES = (
('en', 'English'),
('pl', 'Polish'),
)
# MARKDOWN_DEUX_STYLES =
# "default":
# "extras":
# "code-friendly": None,
# ,
# "safe_mode": "escape",
# ,
#
# ROBOTS SETUP ============================================================================
ROBOTS_USE_SITEMAP = False
ROBOTS_SITEMAP_URLS = [
'http://103.105.98.211:8001/sitemap.xml',
]
ROBOTS_SITEMAP_VIEW_NAME = 'cached-sitemap'
ROBOTS_USE_HOST = False
ROBOTS_USE_SCHEME_IN_HOST = True
ROBOTS_CACHE_TIMEOUT = 60*60*24
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
CORS_ORIGIN_ALLOW_ALL = True
# EXPLORER_CONNECTIONS = 'Default': 'default', 'Pws': 'pws'
# EXPLORER_DEFAULT_CONNECTION = 'default'
# EXPLORER_TASKS_ENABLED = True
# EXPLORER_DEFAULT_ROWS = 5000
# EXPLORER_DATA_EXPORTERS = [('csv', 'explorer.exporters.CSVExporter'), ('excel', 'explorer.exporters.ExcelExporter'), ('json', 'explorer.exporters.JSONExporter')]
# EXPLORER_SQL_WHITELIST = ('CREATED', 'UPDATED', 'DELETED','REGEXP_REPLACE')
# EXPLORER_SQL_BLACKLIST = ('ALTER', 'RENAME ', 'DROP', 'TRUNCATE', 'INSERT INTO', 'UPDATE', 'REPLACE', 'DELETE', 'ALTER', 'CREATE TABLE', 'SCHEMA', 'GRANT', 'OWNER TO')
# EXPLORER_UNSAFE_RENDERING = True
# Whether the Query Inspector should do anything (default: False)
QUERY_INSPECT_ENABLED = True
# Whether to log the stats via Django logging (default: True)
QUERY_INSPECT_LOG_STATS = True
# Whether to add stats headers (default: True)
QUERY_INSPECT_HEADER_STATS = True
# Whether to log duplicate queries (default: False)
QUERY_INSPECT_LOG_QUERIES = True
# Whether to log queries that are above an absolute limit (default: None - disabled)
QUERY_INSPECT_ABSOLUTE_LIMIT = 100 # in milliseconds
# Whether to log queries that are more than X standard deviations above the mean query time (default: None - disabled)
QUERY_INSPECT_STANDARD_DEVIATION_LIMIT = 2
# Whether to include tracebacks in the logs (default: False)
QUERY_INSPECT_LOG_TRACEBACKS = True
# Project root (a list of directories, see below - default empty)
# QUERY_INSPECT_TRACEBACK_ROOTS = ['/path/to/my/django/project/']
ENVIRONMENT_NAME = "Production server"
ENVIRONMENT_COLOR = "#FF2222"
ENVIRONMENT_ADMIN_SELECTOR = "grp-header"
REDISBOARD_DETAIL_FILTERS = ['.*']
ADD_REVERSION_ADMIN=True
`
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349831%2fproblem-when-start-django-with-gunicorn-how-to-fix-it%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Devang Padhiyar thanks for your answer. let see my setting.py file
import os
import datetime
from datetime import timedelta
import time
from django.utils.translation import ugettext_lazy as _
from django.conf.locale.en import formats as es_formats
from django.core.cache import cache
from django.core.validators import RegexValidator
from bs4 import BeautifulSoup
from django.urls import reverse_lazy
from easy_thumbnails.conf import Settings as thumbnail_settings
from django.core.files import File as FileWrapper
from django.shortcuts import redirect
from django.http import Http404
from django.contrib.messages import constants as message_constants
from core import get_shortcut, get_shortcut_setting
MESSAGE_LEVEL = message_constants.DEBUG
AUTH_USER_MODEL = 'auth.User'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '%h_=n$2yh554=2za0zsb%ubk!tg=e0)l@_w@ap#^d#_ew7)yig'
DEBUG = True
ALLOWED_HOSTS = ['0.0.0.0', '103.105.98.214', 'protek.id', 'demo.protek.id', 'localhost']
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
# =========================================================================================
# =========================================================================================
INSTALLED_APPS = [
'django.contrib.contenttypes',
'grappelli.dashboard',
'admin_shortcuts',
'dal',
'dal_select2',
'grappelli',
'django_admin_env_notice',
'django.contrib.admin',
'grappelli_autocomplete_fk_edit_link',
'el_pagination',
'crispy_forms', # http://django-crispy-forms.readthedocs.io/en/latest/install.html
'django_select2', # https://github.com/applegrew/django-select2
'easy_select2',
'easy_thumbnails', # https://github.com/SmileyChris/easy-thumbnails
'image_cropping',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_admin_caching',
'user_sessions', # app/user_sessions/session/
'nested_admin', # inline multiple tree
'tabbed_admin', # tabbed jquery
'watchman', # monitor status database IPADDRESS/watchman/
'django.contrib.humanize', # Money formated for HTML
'mptt', # Tree
'sorl.thumbnail', # http://django-file-picker.readthedocs.io/en/latest/
'clear_cache', # python manage.py clear_cache
'cachetable', # database Cache /app/sysconf/cachetable/
'ckeditor', # editor
'dbbackup_ui', # Bakcup Db dan media | app/backups/backup-database-and-media/
'session_security', # http://django-session-security.readthedocs.io | Ipaddress/session_security/ping/
'reversion', # VersionAdmin data model
'reversion_compare', # https://github.com/jedie/django-reversion-compare
'debug_toolbar', # https://django-debug-toolbar.readthedocs.io
'djangobower', # Pendukung debug toolbar | https://axiacore.com/blog/effective-dependency-management-django-using-bower/
# 'export_action', # Download exel disetiap table model
'import_export', # http://django-import-export.readthedocs.io
'tagging',
'smart_selects', # Berhubungan dengan popup, get dll
'bidiutils', # Context processor
'pipeline', # https://django-pipeline.readthedocs.io/en/latest/installation.html
'django_postgrespool', # Postgres Connection Pooling backend
'djangosecure',
'treewidget',
# 'sysconf',
# 'moderation', # or 'moderation.apps.ModerationConfig',,
'django_pg_current_timestamp',
'django.contrib.sitemaps',
'robots', # https://godjango.com/23-robots-and-sitemaps/
'filer', # https://django-filer.readthedocs.io/en/latest/installation.html
'autofixture', # https://pypi.org/project/django-autofixture/
'corsheaders', # https://www.techiediaries.com/django-cors/
'django_nose',
'redisboard',
'core_doc',
'crm_mstdata',
'globalmasters',
'hris',
'hris_mstdata',
'crm',
'homepage',
'product',
# 'placement',
'facultative',
'finance',
'docman',
'treaty',
]
# =========================================================================================
# =========================================================================================
# BACKEND SETUP =========================================================================
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'user_sessions.middleware.SessionMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'session_security.middleware.SessionSecurityMiddleware',
'x_forwarded_for.middleware.XForwardedForMiddleware',
'qinspect.middleware.QueryInspectMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
]
WSGI_APPLICATION = 'core.wsgi.application'
SESSION_ENGINE = 'user_sessions.backends.db'
SESSION_CACHE_ALIAS = "default"
ROOT_URLCONF = 'core.urls'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
]
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',
,
]
LOGGING =
'version': 1,
'disable_existing_loggers': False,
'handlers':
'console':
'class': 'logging.StreamHandler',
,
,
# 'loggers':
# 'django.db.backends':
# 'level': 'DEBUG',
# 'handlers': ['console'],
# ,
# 'qinspect':
# 'handlers': ['console'],
# 'level': 'DEBUG',
# 'propagate': True,
#
# ,
CACHES =
'default':
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'cachetable',
,
# CACHES =
# "default":
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/1",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient"
# ,
# "KEY_PREFIX": "brokr"
# ,
# 'select2':
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/2",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient",
#
#
#
# SELECT2_CACHE_BACKEND = 'select2'
CACHE_TTL = 60 * 15
SESSION_COOKIE_AGE = 30 * 60 # 30 Menit
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
COMPRESS = True
COMPRESS_AUTO = True
COMPRESS_VERSION = True
COMPRESS_ENABLED = True
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
# =========================================================================================
# =========================================================================================
# FRONT END SETUP =========================================================================
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS
THUMBNAIL_ALIASES =
'':
'avatar': 'size': (50, 50), 'crop': True,
,
THUMBNAIL_HIGH_RESOLUTION = True
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': False,
'OPTIONS':
'debug': DEBUG,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'bidiutils.context_processors.bidi',
'django_admin_env_notice.context_processors.from_settings',
# 'context_processors.app_list',
],
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'apptemplates.Loader',
]),
],
,
,
]
DYNAMIC_PREFERENCES =
'MANAGER_ATTRIBUTE': 'preferences',
'REGISTRY_MODULE': 'dynamic_preferences_registry',
'ADMIN_ENABLE_CHANGELIST_FORM': False,
'SECTION_KEY_SEPARATOR': '__',
'ENABLE_CACHE': True,
'VALIDATE_NAMES': True,
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
LOGIN_URL = '/login/'
ADMIN_MEDIA_PREFIX = '/media/'
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "assets"),
)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
# 'compressor.finders.CompressorFinder',
'pipeline.finders.PipelineFinder',
)
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/assets/bower_components/'
BOWER_PATH = '/usr/bin/bower'
BOWER_INSTALLED_APPS = (
'jquery',
'underscore',
'markitup#1.1.14',
'mediaelement#2.22.0',
'blueimp-file-upload#9.12.5',
)
PIPELINE =
'PIPELINE_ENABLED': True,
'JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
'CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
JS_WRAPPER = "(function()stuff();%s)();"
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_CONFIGS =
'default':
'skin': 'moono-lisa',
'toolbar': [["Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Print"],
['NumberedList', 'BulletedList', "Indent", "Outdent", 'JustifyLeft',
'JustifyCenter','JustifyRight', 'JustifyBlock'],
["Image", "Table", "Link", "Unlink", "Anchor", "SectionLink",
"Subscript", "Superscript"], ['Undo', 'Redo'], ["Source"],
["Maximize"]],
'tabSpaces': 3,
'toolbarCanCollapse': True,
'width': 880,
,
CKEDITOR_ALLOW_NONIMAGE_FILES = False
# TABBED_ADMIN_USE_JQUERY_UI = True
# TABBED_ADMIN_JQUERY_UI_CSS = 'tabbed_admin/css/tabbed_grappelli_admin.css'
# TABBED_ADMIN_JQUERY_UI_JS = 'tabbed_admin/js/jquery-ui-1.11.4.min.js'
LOGIN_REDIRECT_URL = 'home'
LOGOUT_REDIRECT_URL = '/'
UPLOADFILE = '/files/'
STATIC_DEPS = True
# TAGGIT_CASE_INSENSITIVE = True
DEFAULT_FILER_SERVERS =
'private':
'main':
'ENGINE': 'filer.server.backends.default.DefaultServer',
,
'thumbnails':
'ENGINE': 'filer.server.backends.default.DefaultServer',
# =====================================================================================
# =====================================================================================
# DATABASE SETUP ======================================================================
DATABASES =
'default':
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'core',
'USER': 'postgres',
'PASSWORD': 'Kambing1',
'HOST': 'localhost',
'PORT': '5432',
'CONN_MAX_AGE': 60 * 10, # 10 minutes
'AUTOCOMMIT': True,
SOUTH_DATABASE_ADAPTERS =
'default': 'south.db.postgresql_psycopg2'
DATABASE_POOL_ARGS =
'max_overflow': 10,
'pool_size': 5,
'recycle': 300
# =========================================================================================
# =========================================================================================
# OTHER SETUP
VARNISH_MANAGEMENT_ADDRS = ('127.0.0.1:6082',)
es_formats.DATETIME_FORMAT = "Y-m-d H:i:s"
LANGUAGE_CODE = 'en-us'
LANGUAGE_BIDI = True
TIME_ZONE = 'Asia/Jakarta'
USE_I18N = True
USE_L10N = True
USE_TZ = True
SITE_ID = 1
GOOGLE_MAPS_API_KEY = 'AIzaSyD8BxyAFUwWxv2lUnFv06ekTakzTr3sl-E'
IMPORT_EXPORT_USE_TRANSACTIONS = True
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '316233965812-sjbuqlsaat19vesjo6fa44jrlidjit7d.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'ff-pKw85dbNjYxydjM5FTRxz'
# =========================================================================================
# =========================================================================================
# SECURTY UPDATE ========================================================================
X_FRAME_OPTIONS = 'DENY'
CORS_REPLACE_HTTPS_REFERER = False
HOST_SCHEME = "http://"
SECURE_PROXY_SSL_HEADER = None
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SECURE_HSTS_SECONDS = None
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_FRAME_DENY = False
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_HSTS_PRELOAD = True
# =========================================================================================
# =========================================================================================
# EMAIL SETUP =============================================================================
EMAIL_BACKEND = 'django_multiple_email_backends.backend.CombinedEmailBackend'
EMAIL_BACKEND_LIST = ['django.core.mail.backends.filebased.EmailBackend',
'django.core.mail.backends.smtp.EmailBackend']
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'jasawarung@gmail.com'
EMAIL_HOST_PASSWORD = 'cgkxqhzuyfatucor'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
CONTACT_US_EMAIL = 'jasawarung@gmail.com'
# =========================================================================================
# =========================================================================================
# DEBUG TOOLBAR ===========================================================================
def show_toolbar(request):
return True
DEBUG_TOOLBAR_CONFIG =
"SHOW_TOOLBAR_CALLBACK" : show_toolbar,
'DISABLE_PANELS':
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
,
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
CONFIG_DEFAULTS =
'RESULTS_CACHE_SIZE': 3,
'SHOW_COLLAPSED': True,
'SQL_WARNING_THRESHOLD': 100, # milliseconds
# =========================================================================================
# =========================================================================================
# THEME SETUP ============================================================================
GRAPPELLI_INDEX_DASHBOARD = 'core.dashboard.GlobalSetting'
GRAPPELLI_ADMIN_TITLE = 'BROKR PLATFORM'
GRAPPELLI_AUTOCOMPLETE_LIMIT = 20
GRAPPELLI_CLEAN_INPUT_TYPES = True
GRAPPELLI_SWITCH_USER = False
GRAPPELLI_SWITCH_USER_ORIGINAL = True
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
SESSION_EXPIRE_SECONDS = 3600 # 1 hour
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
def itemDate():
return datetime.date.today()
ADMIN_SHORTCUTS = [
'title': 'Date Now : ' + str(itemDate()),
'shortcuts': [
'title': 'Home',
'url': '/',
,
'title': 'Treaty',
'url': '/treaty/',
'icon': 'clipboard',
# 'count_new': 'core.utils.count_submission',
,
'title': 'Facultative',
'url': '/facultative/',
'icon': 'paperclip',
# 'count_new': 'core.utils.count_submission',
,
'title': 'CRM',
'url': '/crm/',
'icon': 'address-book',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Project',
# 'url': '/placement/',
# 'icon': 'folder',
# 'count_new': 'core.utils.count_submission',
# ,
'title': 'HRD',
'url': '/hris/',
'icon': 'users',
# 'count_new': 'core.utils.count_account',
,
'title': 'Financial & Accounting',
'url': '/finance/',
'icon': 'chart-pie',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Profile',
# 'url': '/hris/employeesadmin/',
# 'icon': 'user',
# ,
]
,
]
ADMIN_SHORTCUTS_SETTINGS =
'show_on_all_pages': True,
'hide_app_list': False,
'open_new_window': False,
CRISPY_TEMPLATE_PACK = 'uni_form'
APPEND_SLASH = False
LANGUAGES = (
('en', 'English'),
('pl', 'Polish'),
)
# MARKDOWN_DEUX_STYLES =
# "default":
# "extras":
# "code-friendly": None,
# ,
# "safe_mode": "escape",
# ,
#
# ROBOTS SETUP ============================================================================
ROBOTS_USE_SITEMAP = False
ROBOTS_SITEMAP_URLS = [
'http://103.105.98.211:8001/sitemap.xml',
]
ROBOTS_SITEMAP_VIEW_NAME = 'cached-sitemap'
ROBOTS_USE_HOST = False
ROBOTS_USE_SCHEME_IN_HOST = True
ROBOTS_CACHE_TIMEOUT = 60*60*24
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
CORS_ORIGIN_ALLOW_ALL = True
# EXPLORER_CONNECTIONS = 'Default': 'default', 'Pws': 'pws'
# EXPLORER_DEFAULT_CONNECTION = 'default'
# EXPLORER_TASKS_ENABLED = True
# EXPLORER_DEFAULT_ROWS = 5000
# EXPLORER_DATA_EXPORTERS = [('csv', 'explorer.exporters.CSVExporter'), ('excel', 'explorer.exporters.ExcelExporter'), ('json', 'explorer.exporters.JSONExporter')]
# EXPLORER_SQL_WHITELIST = ('CREATED', 'UPDATED', 'DELETED','REGEXP_REPLACE')
# EXPLORER_SQL_BLACKLIST = ('ALTER', 'RENAME ', 'DROP', 'TRUNCATE', 'INSERT INTO', 'UPDATE', 'REPLACE', 'DELETE', 'ALTER', 'CREATE TABLE', 'SCHEMA', 'GRANT', 'OWNER TO')
# EXPLORER_UNSAFE_RENDERING = True
# Whether the Query Inspector should do anything (default: False)
QUERY_INSPECT_ENABLED = True
# Whether to log the stats via Django logging (default: True)
QUERY_INSPECT_LOG_STATS = True
# Whether to add stats headers (default: True)
QUERY_INSPECT_HEADER_STATS = True
# Whether to log duplicate queries (default: False)
QUERY_INSPECT_LOG_QUERIES = True
# Whether to log queries that are above an absolute limit (default: None - disabled)
QUERY_INSPECT_ABSOLUTE_LIMIT = 100 # in milliseconds
# Whether to log queries that are more than X standard deviations above the mean query time (default: None - disabled)
QUERY_INSPECT_STANDARD_DEVIATION_LIMIT = 2
# Whether to include tracebacks in the logs (default: False)
QUERY_INSPECT_LOG_TRACEBACKS = True
# Project root (a list of directories, see below - default empty)
# QUERY_INSPECT_TRACEBACK_ROOTS = ['/path/to/my/django/project/']
ENVIRONMENT_NAME = "Production server"
ENVIRONMENT_COLOR = "#FF2222"
ENVIRONMENT_ADMIN_SELECTOR = "grp-header"
REDISBOARD_DETAIL_FILTERS = ['.*']
ADD_REVERSION_ADMIN=True
`
add a comment |
Devang Padhiyar thanks for your answer. let see my setting.py file
import os
import datetime
from datetime import timedelta
import time
from django.utils.translation import ugettext_lazy as _
from django.conf.locale.en import formats as es_formats
from django.core.cache import cache
from django.core.validators import RegexValidator
from bs4 import BeautifulSoup
from django.urls import reverse_lazy
from easy_thumbnails.conf import Settings as thumbnail_settings
from django.core.files import File as FileWrapper
from django.shortcuts import redirect
from django.http import Http404
from django.contrib.messages import constants as message_constants
from core import get_shortcut, get_shortcut_setting
MESSAGE_LEVEL = message_constants.DEBUG
AUTH_USER_MODEL = 'auth.User'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '%h_=n$2yh554=2za0zsb%ubk!tg=e0)l@_w@ap#^d#_ew7)yig'
DEBUG = True
ALLOWED_HOSTS = ['0.0.0.0', '103.105.98.214', 'protek.id', 'demo.protek.id', 'localhost']
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
# =========================================================================================
# =========================================================================================
INSTALLED_APPS = [
'django.contrib.contenttypes',
'grappelli.dashboard',
'admin_shortcuts',
'dal',
'dal_select2',
'grappelli',
'django_admin_env_notice',
'django.contrib.admin',
'grappelli_autocomplete_fk_edit_link',
'el_pagination',
'crispy_forms', # http://django-crispy-forms.readthedocs.io/en/latest/install.html
'django_select2', # https://github.com/applegrew/django-select2
'easy_select2',
'easy_thumbnails', # https://github.com/SmileyChris/easy-thumbnails
'image_cropping',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_admin_caching',
'user_sessions', # app/user_sessions/session/
'nested_admin', # inline multiple tree
'tabbed_admin', # tabbed jquery
'watchman', # monitor status database IPADDRESS/watchman/
'django.contrib.humanize', # Money formated for HTML
'mptt', # Tree
'sorl.thumbnail', # http://django-file-picker.readthedocs.io/en/latest/
'clear_cache', # python manage.py clear_cache
'cachetable', # database Cache /app/sysconf/cachetable/
'ckeditor', # editor
'dbbackup_ui', # Bakcup Db dan media | app/backups/backup-database-and-media/
'session_security', # http://django-session-security.readthedocs.io | Ipaddress/session_security/ping/
'reversion', # VersionAdmin data model
'reversion_compare', # https://github.com/jedie/django-reversion-compare
'debug_toolbar', # https://django-debug-toolbar.readthedocs.io
'djangobower', # Pendukung debug toolbar | https://axiacore.com/blog/effective-dependency-management-django-using-bower/
# 'export_action', # Download exel disetiap table model
'import_export', # http://django-import-export.readthedocs.io
'tagging',
'smart_selects', # Berhubungan dengan popup, get dll
'bidiutils', # Context processor
'pipeline', # https://django-pipeline.readthedocs.io/en/latest/installation.html
'django_postgrespool', # Postgres Connection Pooling backend
'djangosecure',
'treewidget',
# 'sysconf',
# 'moderation', # or 'moderation.apps.ModerationConfig',,
'django_pg_current_timestamp',
'django.contrib.sitemaps',
'robots', # https://godjango.com/23-robots-and-sitemaps/
'filer', # https://django-filer.readthedocs.io/en/latest/installation.html
'autofixture', # https://pypi.org/project/django-autofixture/
'corsheaders', # https://www.techiediaries.com/django-cors/
'django_nose',
'redisboard',
'core_doc',
'crm_mstdata',
'globalmasters',
'hris',
'hris_mstdata',
'crm',
'homepage',
'product',
# 'placement',
'facultative',
'finance',
'docman',
'treaty',
]
# =========================================================================================
# =========================================================================================
# BACKEND SETUP =========================================================================
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'user_sessions.middleware.SessionMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'session_security.middleware.SessionSecurityMiddleware',
'x_forwarded_for.middleware.XForwardedForMiddleware',
'qinspect.middleware.QueryInspectMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
]
WSGI_APPLICATION = 'core.wsgi.application'
SESSION_ENGINE = 'user_sessions.backends.db'
SESSION_CACHE_ALIAS = "default"
ROOT_URLCONF = 'core.urls'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
]
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',
,
]
LOGGING =
'version': 1,
'disable_existing_loggers': False,
'handlers':
'console':
'class': 'logging.StreamHandler',
,
,
# 'loggers':
# 'django.db.backends':
# 'level': 'DEBUG',
# 'handlers': ['console'],
# ,
# 'qinspect':
# 'handlers': ['console'],
# 'level': 'DEBUG',
# 'propagate': True,
#
# ,
CACHES =
'default':
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'cachetable',
,
# CACHES =
# "default":
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/1",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient"
# ,
# "KEY_PREFIX": "brokr"
# ,
# 'select2':
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/2",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient",
#
#
#
# SELECT2_CACHE_BACKEND = 'select2'
CACHE_TTL = 60 * 15
SESSION_COOKIE_AGE = 30 * 60 # 30 Menit
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
COMPRESS = True
COMPRESS_AUTO = True
COMPRESS_VERSION = True
COMPRESS_ENABLED = True
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
# =========================================================================================
# =========================================================================================
# FRONT END SETUP =========================================================================
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS
THUMBNAIL_ALIASES =
'':
'avatar': 'size': (50, 50), 'crop': True,
,
THUMBNAIL_HIGH_RESOLUTION = True
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': False,
'OPTIONS':
'debug': DEBUG,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'bidiutils.context_processors.bidi',
'django_admin_env_notice.context_processors.from_settings',
# 'context_processors.app_list',
],
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'apptemplates.Loader',
]),
],
,
,
]
DYNAMIC_PREFERENCES =
'MANAGER_ATTRIBUTE': 'preferences',
'REGISTRY_MODULE': 'dynamic_preferences_registry',
'ADMIN_ENABLE_CHANGELIST_FORM': False,
'SECTION_KEY_SEPARATOR': '__',
'ENABLE_CACHE': True,
'VALIDATE_NAMES': True,
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
LOGIN_URL = '/login/'
ADMIN_MEDIA_PREFIX = '/media/'
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "assets"),
)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
# 'compressor.finders.CompressorFinder',
'pipeline.finders.PipelineFinder',
)
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/assets/bower_components/'
BOWER_PATH = '/usr/bin/bower'
BOWER_INSTALLED_APPS = (
'jquery',
'underscore',
'markitup#1.1.14',
'mediaelement#2.22.0',
'blueimp-file-upload#9.12.5',
)
PIPELINE =
'PIPELINE_ENABLED': True,
'JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
'CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
JS_WRAPPER = "(function()stuff();%s)();"
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_CONFIGS =
'default':
'skin': 'moono-lisa',
'toolbar': [["Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Print"],
['NumberedList', 'BulletedList', "Indent", "Outdent", 'JustifyLeft',
'JustifyCenter','JustifyRight', 'JustifyBlock'],
["Image", "Table", "Link", "Unlink", "Anchor", "SectionLink",
"Subscript", "Superscript"], ['Undo', 'Redo'], ["Source"],
["Maximize"]],
'tabSpaces': 3,
'toolbarCanCollapse': True,
'width': 880,
,
CKEDITOR_ALLOW_NONIMAGE_FILES = False
# TABBED_ADMIN_USE_JQUERY_UI = True
# TABBED_ADMIN_JQUERY_UI_CSS = 'tabbed_admin/css/tabbed_grappelli_admin.css'
# TABBED_ADMIN_JQUERY_UI_JS = 'tabbed_admin/js/jquery-ui-1.11.4.min.js'
LOGIN_REDIRECT_URL = 'home'
LOGOUT_REDIRECT_URL = '/'
UPLOADFILE = '/files/'
STATIC_DEPS = True
# TAGGIT_CASE_INSENSITIVE = True
DEFAULT_FILER_SERVERS =
'private':
'main':
'ENGINE': 'filer.server.backends.default.DefaultServer',
,
'thumbnails':
'ENGINE': 'filer.server.backends.default.DefaultServer',
# =====================================================================================
# =====================================================================================
# DATABASE SETUP ======================================================================
DATABASES =
'default':
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'core',
'USER': 'postgres',
'PASSWORD': 'Kambing1',
'HOST': 'localhost',
'PORT': '5432',
'CONN_MAX_AGE': 60 * 10, # 10 minutes
'AUTOCOMMIT': True,
SOUTH_DATABASE_ADAPTERS =
'default': 'south.db.postgresql_psycopg2'
DATABASE_POOL_ARGS =
'max_overflow': 10,
'pool_size': 5,
'recycle': 300
# =========================================================================================
# =========================================================================================
# OTHER SETUP
VARNISH_MANAGEMENT_ADDRS = ('127.0.0.1:6082',)
es_formats.DATETIME_FORMAT = "Y-m-d H:i:s"
LANGUAGE_CODE = 'en-us'
LANGUAGE_BIDI = True
TIME_ZONE = 'Asia/Jakarta'
USE_I18N = True
USE_L10N = True
USE_TZ = True
SITE_ID = 1
GOOGLE_MAPS_API_KEY = 'AIzaSyD8BxyAFUwWxv2lUnFv06ekTakzTr3sl-E'
IMPORT_EXPORT_USE_TRANSACTIONS = True
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '316233965812-sjbuqlsaat19vesjo6fa44jrlidjit7d.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'ff-pKw85dbNjYxydjM5FTRxz'
# =========================================================================================
# =========================================================================================
# SECURTY UPDATE ========================================================================
X_FRAME_OPTIONS = 'DENY'
CORS_REPLACE_HTTPS_REFERER = False
HOST_SCHEME = "http://"
SECURE_PROXY_SSL_HEADER = None
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SECURE_HSTS_SECONDS = None
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_FRAME_DENY = False
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_HSTS_PRELOAD = True
# =========================================================================================
# =========================================================================================
# EMAIL SETUP =============================================================================
EMAIL_BACKEND = 'django_multiple_email_backends.backend.CombinedEmailBackend'
EMAIL_BACKEND_LIST = ['django.core.mail.backends.filebased.EmailBackend',
'django.core.mail.backends.smtp.EmailBackend']
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'jasawarung@gmail.com'
EMAIL_HOST_PASSWORD = 'cgkxqhzuyfatucor'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
CONTACT_US_EMAIL = 'jasawarung@gmail.com'
# =========================================================================================
# =========================================================================================
# DEBUG TOOLBAR ===========================================================================
def show_toolbar(request):
return True
DEBUG_TOOLBAR_CONFIG =
"SHOW_TOOLBAR_CALLBACK" : show_toolbar,
'DISABLE_PANELS':
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
,
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
CONFIG_DEFAULTS =
'RESULTS_CACHE_SIZE': 3,
'SHOW_COLLAPSED': True,
'SQL_WARNING_THRESHOLD': 100, # milliseconds
# =========================================================================================
# =========================================================================================
# THEME SETUP ============================================================================
GRAPPELLI_INDEX_DASHBOARD = 'core.dashboard.GlobalSetting'
GRAPPELLI_ADMIN_TITLE = 'BROKR PLATFORM'
GRAPPELLI_AUTOCOMPLETE_LIMIT = 20
GRAPPELLI_CLEAN_INPUT_TYPES = True
GRAPPELLI_SWITCH_USER = False
GRAPPELLI_SWITCH_USER_ORIGINAL = True
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
SESSION_EXPIRE_SECONDS = 3600 # 1 hour
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
def itemDate():
return datetime.date.today()
ADMIN_SHORTCUTS = [
'title': 'Date Now : ' + str(itemDate()),
'shortcuts': [
'title': 'Home',
'url': '/',
,
'title': 'Treaty',
'url': '/treaty/',
'icon': 'clipboard',
# 'count_new': 'core.utils.count_submission',
,
'title': 'Facultative',
'url': '/facultative/',
'icon': 'paperclip',
# 'count_new': 'core.utils.count_submission',
,
'title': 'CRM',
'url': '/crm/',
'icon': 'address-book',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Project',
# 'url': '/placement/',
# 'icon': 'folder',
# 'count_new': 'core.utils.count_submission',
# ,
'title': 'HRD',
'url': '/hris/',
'icon': 'users',
# 'count_new': 'core.utils.count_account',
,
'title': 'Financial & Accounting',
'url': '/finance/',
'icon': 'chart-pie',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Profile',
# 'url': '/hris/employeesadmin/',
# 'icon': 'user',
# ,
]
,
]
ADMIN_SHORTCUTS_SETTINGS =
'show_on_all_pages': True,
'hide_app_list': False,
'open_new_window': False,
CRISPY_TEMPLATE_PACK = 'uni_form'
APPEND_SLASH = False
LANGUAGES = (
('en', 'English'),
('pl', 'Polish'),
)
# MARKDOWN_DEUX_STYLES =
# "default":
# "extras":
# "code-friendly": None,
# ,
# "safe_mode": "escape",
# ,
#
# ROBOTS SETUP ============================================================================
ROBOTS_USE_SITEMAP = False
ROBOTS_SITEMAP_URLS = [
'http://103.105.98.211:8001/sitemap.xml',
]
ROBOTS_SITEMAP_VIEW_NAME = 'cached-sitemap'
ROBOTS_USE_HOST = False
ROBOTS_USE_SCHEME_IN_HOST = True
ROBOTS_CACHE_TIMEOUT = 60*60*24
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
CORS_ORIGIN_ALLOW_ALL = True
# EXPLORER_CONNECTIONS = 'Default': 'default', 'Pws': 'pws'
# EXPLORER_DEFAULT_CONNECTION = 'default'
# EXPLORER_TASKS_ENABLED = True
# EXPLORER_DEFAULT_ROWS = 5000
# EXPLORER_DATA_EXPORTERS = [('csv', 'explorer.exporters.CSVExporter'), ('excel', 'explorer.exporters.ExcelExporter'), ('json', 'explorer.exporters.JSONExporter')]
# EXPLORER_SQL_WHITELIST = ('CREATED', 'UPDATED', 'DELETED','REGEXP_REPLACE')
# EXPLORER_SQL_BLACKLIST = ('ALTER', 'RENAME ', 'DROP', 'TRUNCATE', 'INSERT INTO', 'UPDATE', 'REPLACE', 'DELETE', 'ALTER', 'CREATE TABLE', 'SCHEMA', 'GRANT', 'OWNER TO')
# EXPLORER_UNSAFE_RENDERING = True
# Whether the Query Inspector should do anything (default: False)
QUERY_INSPECT_ENABLED = True
# Whether to log the stats via Django logging (default: True)
QUERY_INSPECT_LOG_STATS = True
# Whether to add stats headers (default: True)
QUERY_INSPECT_HEADER_STATS = True
# Whether to log duplicate queries (default: False)
QUERY_INSPECT_LOG_QUERIES = True
# Whether to log queries that are above an absolute limit (default: None - disabled)
QUERY_INSPECT_ABSOLUTE_LIMIT = 100 # in milliseconds
# Whether to log queries that are more than X standard deviations above the mean query time (default: None - disabled)
QUERY_INSPECT_STANDARD_DEVIATION_LIMIT = 2
# Whether to include tracebacks in the logs (default: False)
QUERY_INSPECT_LOG_TRACEBACKS = True
# Project root (a list of directories, see below - default empty)
# QUERY_INSPECT_TRACEBACK_ROOTS = ['/path/to/my/django/project/']
ENVIRONMENT_NAME = "Production server"
ENVIRONMENT_COLOR = "#FF2222"
ENVIRONMENT_ADMIN_SELECTOR = "grp-header"
REDISBOARD_DETAIL_FILTERS = ['.*']
ADD_REVERSION_ADMIN=True
`
add a comment |
Devang Padhiyar thanks for your answer. let see my setting.py file
import os
import datetime
from datetime import timedelta
import time
from django.utils.translation import ugettext_lazy as _
from django.conf.locale.en import formats as es_formats
from django.core.cache import cache
from django.core.validators import RegexValidator
from bs4 import BeautifulSoup
from django.urls import reverse_lazy
from easy_thumbnails.conf import Settings as thumbnail_settings
from django.core.files import File as FileWrapper
from django.shortcuts import redirect
from django.http import Http404
from django.contrib.messages import constants as message_constants
from core import get_shortcut, get_shortcut_setting
MESSAGE_LEVEL = message_constants.DEBUG
AUTH_USER_MODEL = 'auth.User'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '%h_=n$2yh554=2za0zsb%ubk!tg=e0)l@_w@ap#^d#_ew7)yig'
DEBUG = True
ALLOWED_HOSTS = ['0.0.0.0', '103.105.98.214', 'protek.id', 'demo.protek.id', 'localhost']
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
# =========================================================================================
# =========================================================================================
INSTALLED_APPS = [
'django.contrib.contenttypes',
'grappelli.dashboard',
'admin_shortcuts',
'dal',
'dal_select2',
'grappelli',
'django_admin_env_notice',
'django.contrib.admin',
'grappelli_autocomplete_fk_edit_link',
'el_pagination',
'crispy_forms', # http://django-crispy-forms.readthedocs.io/en/latest/install.html
'django_select2', # https://github.com/applegrew/django-select2
'easy_select2',
'easy_thumbnails', # https://github.com/SmileyChris/easy-thumbnails
'image_cropping',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_admin_caching',
'user_sessions', # app/user_sessions/session/
'nested_admin', # inline multiple tree
'tabbed_admin', # tabbed jquery
'watchman', # monitor status database IPADDRESS/watchman/
'django.contrib.humanize', # Money formated for HTML
'mptt', # Tree
'sorl.thumbnail', # http://django-file-picker.readthedocs.io/en/latest/
'clear_cache', # python manage.py clear_cache
'cachetable', # database Cache /app/sysconf/cachetable/
'ckeditor', # editor
'dbbackup_ui', # Bakcup Db dan media | app/backups/backup-database-and-media/
'session_security', # http://django-session-security.readthedocs.io | Ipaddress/session_security/ping/
'reversion', # VersionAdmin data model
'reversion_compare', # https://github.com/jedie/django-reversion-compare
'debug_toolbar', # https://django-debug-toolbar.readthedocs.io
'djangobower', # Pendukung debug toolbar | https://axiacore.com/blog/effective-dependency-management-django-using-bower/
# 'export_action', # Download exel disetiap table model
'import_export', # http://django-import-export.readthedocs.io
'tagging',
'smart_selects', # Berhubungan dengan popup, get dll
'bidiutils', # Context processor
'pipeline', # https://django-pipeline.readthedocs.io/en/latest/installation.html
'django_postgrespool', # Postgres Connection Pooling backend
'djangosecure',
'treewidget',
# 'sysconf',
# 'moderation', # or 'moderation.apps.ModerationConfig',,
'django_pg_current_timestamp',
'django.contrib.sitemaps',
'robots', # https://godjango.com/23-robots-and-sitemaps/
'filer', # https://django-filer.readthedocs.io/en/latest/installation.html
'autofixture', # https://pypi.org/project/django-autofixture/
'corsheaders', # https://www.techiediaries.com/django-cors/
'django_nose',
'redisboard',
'core_doc',
'crm_mstdata',
'globalmasters',
'hris',
'hris_mstdata',
'crm',
'homepage',
'product',
# 'placement',
'facultative',
'finance',
'docman',
'treaty',
]
# =========================================================================================
# =========================================================================================
# BACKEND SETUP =========================================================================
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'user_sessions.middleware.SessionMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'session_security.middleware.SessionSecurityMiddleware',
'x_forwarded_for.middleware.XForwardedForMiddleware',
'qinspect.middleware.QueryInspectMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
]
WSGI_APPLICATION = 'core.wsgi.application'
SESSION_ENGINE = 'user_sessions.backends.db'
SESSION_CACHE_ALIAS = "default"
ROOT_URLCONF = 'core.urls'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
]
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',
,
]
LOGGING =
'version': 1,
'disable_existing_loggers': False,
'handlers':
'console':
'class': 'logging.StreamHandler',
,
,
# 'loggers':
# 'django.db.backends':
# 'level': 'DEBUG',
# 'handlers': ['console'],
# ,
# 'qinspect':
# 'handlers': ['console'],
# 'level': 'DEBUG',
# 'propagate': True,
#
# ,
CACHES =
'default':
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'cachetable',
,
# CACHES =
# "default":
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/1",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient"
# ,
# "KEY_PREFIX": "brokr"
# ,
# 'select2':
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/2",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient",
#
#
#
# SELECT2_CACHE_BACKEND = 'select2'
CACHE_TTL = 60 * 15
SESSION_COOKIE_AGE = 30 * 60 # 30 Menit
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
COMPRESS = True
COMPRESS_AUTO = True
COMPRESS_VERSION = True
COMPRESS_ENABLED = True
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
# =========================================================================================
# =========================================================================================
# FRONT END SETUP =========================================================================
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS
THUMBNAIL_ALIASES =
'':
'avatar': 'size': (50, 50), 'crop': True,
,
THUMBNAIL_HIGH_RESOLUTION = True
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': False,
'OPTIONS':
'debug': DEBUG,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'bidiutils.context_processors.bidi',
'django_admin_env_notice.context_processors.from_settings',
# 'context_processors.app_list',
],
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'apptemplates.Loader',
]),
],
,
,
]
DYNAMIC_PREFERENCES =
'MANAGER_ATTRIBUTE': 'preferences',
'REGISTRY_MODULE': 'dynamic_preferences_registry',
'ADMIN_ENABLE_CHANGELIST_FORM': False,
'SECTION_KEY_SEPARATOR': '__',
'ENABLE_CACHE': True,
'VALIDATE_NAMES': True,
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
LOGIN_URL = '/login/'
ADMIN_MEDIA_PREFIX = '/media/'
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "assets"),
)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
# 'compressor.finders.CompressorFinder',
'pipeline.finders.PipelineFinder',
)
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/assets/bower_components/'
BOWER_PATH = '/usr/bin/bower'
BOWER_INSTALLED_APPS = (
'jquery',
'underscore',
'markitup#1.1.14',
'mediaelement#2.22.0',
'blueimp-file-upload#9.12.5',
)
PIPELINE =
'PIPELINE_ENABLED': True,
'JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
'CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
JS_WRAPPER = "(function()stuff();%s)();"
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_CONFIGS =
'default':
'skin': 'moono-lisa',
'toolbar': [["Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Print"],
['NumberedList', 'BulletedList', "Indent", "Outdent", 'JustifyLeft',
'JustifyCenter','JustifyRight', 'JustifyBlock'],
["Image", "Table", "Link", "Unlink", "Anchor", "SectionLink",
"Subscript", "Superscript"], ['Undo', 'Redo'], ["Source"],
["Maximize"]],
'tabSpaces': 3,
'toolbarCanCollapse': True,
'width': 880,
,
CKEDITOR_ALLOW_NONIMAGE_FILES = False
# TABBED_ADMIN_USE_JQUERY_UI = True
# TABBED_ADMIN_JQUERY_UI_CSS = 'tabbed_admin/css/tabbed_grappelli_admin.css'
# TABBED_ADMIN_JQUERY_UI_JS = 'tabbed_admin/js/jquery-ui-1.11.4.min.js'
LOGIN_REDIRECT_URL = 'home'
LOGOUT_REDIRECT_URL = '/'
UPLOADFILE = '/files/'
STATIC_DEPS = True
# TAGGIT_CASE_INSENSITIVE = True
DEFAULT_FILER_SERVERS =
'private':
'main':
'ENGINE': 'filer.server.backends.default.DefaultServer',
,
'thumbnails':
'ENGINE': 'filer.server.backends.default.DefaultServer',
# =====================================================================================
# =====================================================================================
# DATABASE SETUP ======================================================================
DATABASES =
'default':
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'core',
'USER': 'postgres',
'PASSWORD': 'Kambing1',
'HOST': 'localhost',
'PORT': '5432',
'CONN_MAX_AGE': 60 * 10, # 10 minutes
'AUTOCOMMIT': True,
SOUTH_DATABASE_ADAPTERS =
'default': 'south.db.postgresql_psycopg2'
DATABASE_POOL_ARGS =
'max_overflow': 10,
'pool_size': 5,
'recycle': 300
# =========================================================================================
# =========================================================================================
# OTHER SETUP
VARNISH_MANAGEMENT_ADDRS = ('127.0.0.1:6082',)
es_formats.DATETIME_FORMAT = "Y-m-d H:i:s"
LANGUAGE_CODE = 'en-us'
LANGUAGE_BIDI = True
TIME_ZONE = 'Asia/Jakarta'
USE_I18N = True
USE_L10N = True
USE_TZ = True
SITE_ID = 1
GOOGLE_MAPS_API_KEY = 'AIzaSyD8BxyAFUwWxv2lUnFv06ekTakzTr3sl-E'
IMPORT_EXPORT_USE_TRANSACTIONS = True
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '316233965812-sjbuqlsaat19vesjo6fa44jrlidjit7d.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'ff-pKw85dbNjYxydjM5FTRxz'
# =========================================================================================
# =========================================================================================
# SECURTY UPDATE ========================================================================
X_FRAME_OPTIONS = 'DENY'
CORS_REPLACE_HTTPS_REFERER = False
HOST_SCHEME = "http://"
SECURE_PROXY_SSL_HEADER = None
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SECURE_HSTS_SECONDS = None
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_FRAME_DENY = False
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_HSTS_PRELOAD = True
# =========================================================================================
# =========================================================================================
# EMAIL SETUP =============================================================================
EMAIL_BACKEND = 'django_multiple_email_backends.backend.CombinedEmailBackend'
EMAIL_BACKEND_LIST = ['django.core.mail.backends.filebased.EmailBackend',
'django.core.mail.backends.smtp.EmailBackend']
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'jasawarung@gmail.com'
EMAIL_HOST_PASSWORD = 'cgkxqhzuyfatucor'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
CONTACT_US_EMAIL = 'jasawarung@gmail.com'
# =========================================================================================
# =========================================================================================
# DEBUG TOOLBAR ===========================================================================
def show_toolbar(request):
return True
DEBUG_TOOLBAR_CONFIG =
"SHOW_TOOLBAR_CALLBACK" : show_toolbar,
'DISABLE_PANELS':
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
,
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
CONFIG_DEFAULTS =
'RESULTS_CACHE_SIZE': 3,
'SHOW_COLLAPSED': True,
'SQL_WARNING_THRESHOLD': 100, # milliseconds
# =========================================================================================
# =========================================================================================
# THEME SETUP ============================================================================
GRAPPELLI_INDEX_DASHBOARD = 'core.dashboard.GlobalSetting'
GRAPPELLI_ADMIN_TITLE = 'BROKR PLATFORM'
GRAPPELLI_AUTOCOMPLETE_LIMIT = 20
GRAPPELLI_CLEAN_INPUT_TYPES = True
GRAPPELLI_SWITCH_USER = False
GRAPPELLI_SWITCH_USER_ORIGINAL = True
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
SESSION_EXPIRE_SECONDS = 3600 # 1 hour
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
def itemDate():
return datetime.date.today()
ADMIN_SHORTCUTS = [
'title': 'Date Now : ' + str(itemDate()),
'shortcuts': [
'title': 'Home',
'url': '/',
,
'title': 'Treaty',
'url': '/treaty/',
'icon': 'clipboard',
# 'count_new': 'core.utils.count_submission',
,
'title': 'Facultative',
'url': '/facultative/',
'icon': 'paperclip',
# 'count_new': 'core.utils.count_submission',
,
'title': 'CRM',
'url': '/crm/',
'icon': 'address-book',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Project',
# 'url': '/placement/',
# 'icon': 'folder',
# 'count_new': 'core.utils.count_submission',
# ,
'title': 'HRD',
'url': '/hris/',
'icon': 'users',
# 'count_new': 'core.utils.count_account',
,
'title': 'Financial & Accounting',
'url': '/finance/',
'icon': 'chart-pie',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Profile',
# 'url': '/hris/employeesadmin/',
# 'icon': 'user',
# ,
]
,
]
ADMIN_SHORTCUTS_SETTINGS =
'show_on_all_pages': True,
'hide_app_list': False,
'open_new_window': False,
CRISPY_TEMPLATE_PACK = 'uni_form'
APPEND_SLASH = False
LANGUAGES = (
('en', 'English'),
('pl', 'Polish'),
)
# MARKDOWN_DEUX_STYLES =
# "default":
# "extras":
# "code-friendly": None,
# ,
# "safe_mode": "escape",
# ,
#
# ROBOTS SETUP ============================================================================
ROBOTS_USE_SITEMAP = False
ROBOTS_SITEMAP_URLS = [
'http://103.105.98.211:8001/sitemap.xml',
]
ROBOTS_SITEMAP_VIEW_NAME = 'cached-sitemap'
ROBOTS_USE_HOST = False
ROBOTS_USE_SCHEME_IN_HOST = True
ROBOTS_CACHE_TIMEOUT = 60*60*24
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
CORS_ORIGIN_ALLOW_ALL = True
# EXPLORER_CONNECTIONS = 'Default': 'default', 'Pws': 'pws'
# EXPLORER_DEFAULT_CONNECTION = 'default'
# EXPLORER_TASKS_ENABLED = True
# EXPLORER_DEFAULT_ROWS = 5000
# EXPLORER_DATA_EXPORTERS = [('csv', 'explorer.exporters.CSVExporter'), ('excel', 'explorer.exporters.ExcelExporter'), ('json', 'explorer.exporters.JSONExporter')]
# EXPLORER_SQL_WHITELIST = ('CREATED', 'UPDATED', 'DELETED','REGEXP_REPLACE')
# EXPLORER_SQL_BLACKLIST = ('ALTER', 'RENAME ', 'DROP', 'TRUNCATE', 'INSERT INTO', 'UPDATE', 'REPLACE', 'DELETE', 'ALTER', 'CREATE TABLE', 'SCHEMA', 'GRANT', 'OWNER TO')
# EXPLORER_UNSAFE_RENDERING = True
# Whether the Query Inspector should do anything (default: False)
QUERY_INSPECT_ENABLED = True
# Whether to log the stats via Django logging (default: True)
QUERY_INSPECT_LOG_STATS = True
# Whether to add stats headers (default: True)
QUERY_INSPECT_HEADER_STATS = True
# Whether to log duplicate queries (default: False)
QUERY_INSPECT_LOG_QUERIES = True
# Whether to log queries that are above an absolute limit (default: None - disabled)
QUERY_INSPECT_ABSOLUTE_LIMIT = 100 # in milliseconds
# Whether to log queries that are more than X standard deviations above the mean query time (default: None - disabled)
QUERY_INSPECT_STANDARD_DEVIATION_LIMIT = 2
# Whether to include tracebacks in the logs (default: False)
QUERY_INSPECT_LOG_TRACEBACKS = True
# Project root (a list of directories, see below - default empty)
# QUERY_INSPECT_TRACEBACK_ROOTS = ['/path/to/my/django/project/']
ENVIRONMENT_NAME = "Production server"
ENVIRONMENT_COLOR = "#FF2222"
ENVIRONMENT_ADMIN_SELECTOR = "grp-header"
REDISBOARD_DETAIL_FILTERS = ['.*']
ADD_REVERSION_ADMIN=True
`
Devang Padhiyar thanks for your answer. let see my setting.py file
import os
import datetime
from datetime import timedelta
import time
from django.utils.translation import ugettext_lazy as _
from django.conf.locale.en import formats as es_formats
from django.core.cache import cache
from django.core.validators import RegexValidator
from bs4 import BeautifulSoup
from django.urls import reverse_lazy
from easy_thumbnails.conf import Settings as thumbnail_settings
from django.core.files import File as FileWrapper
from django.shortcuts import redirect
from django.http import Http404
from django.contrib.messages import constants as message_constants
from core import get_shortcut, get_shortcut_setting
MESSAGE_LEVEL = message_constants.DEBUG
AUTH_USER_MODEL = 'auth.User'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '%h_=n$2yh554=2za0zsb%ubk!tg=e0)l@_w@ap#^d#_ew7)yig'
DEBUG = True
ALLOWED_HOSTS = ['0.0.0.0', '103.105.98.214', 'protek.id', 'demo.protek.id', 'localhost']
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
# =========================================================================================
# =========================================================================================
INSTALLED_APPS = [
'django.contrib.contenttypes',
'grappelli.dashboard',
'admin_shortcuts',
'dal',
'dal_select2',
'grappelli',
'django_admin_env_notice',
'django.contrib.admin',
'grappelli_autocomplete_fk_edit_link',
'el_pagination',
'crispy_forms', # http://django-crispy-forms.readthedocs.io/en/latest/install.html
'django_select2', # https://github.com/applegrew/django-select2
'easy_select2',
'easy_thumbnails', # https://github.com/SmileyChris/easy-thumbnails
'image_cropping',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django_admin_caching',
'user_sessions', # app/user_sessions/session/
'nested_admin', # inline multiple tree
'tabbed_admin', # tabbed jquery
'watchman', # monitor status database IPADDRESS/watchman/
'django.contrib.humanize', # Money formated for HTML
'mptt', # Tree
'sorl.thumbnail', # http://django-file-picker.readthedocs.io/en/latest/
'clear_cache', # python manage.py clear_cache
'cachetable', # database Cache /app/sysconf/cachetable/
'ckeditor', # editor
'dbbackup_ui', # Bakcup Db dan media | app/backups/backup-database-and-media/
'session_security', # http://django-session-security.readthedocs.io | Ipaddress/session_security/ping/
'reversion', # VersionAdmin data model
'reversion_compare', # https://github.com/jedie/django-reversion-compare
'debug_toolbar', # https://django-debug-toolbar.readthedocs.io
'djangobower', # Pendukung debug toolbar | https://axiacore.com/blog/effective-dependency-management-django-using-bower/
# 'export_action', # Download exel disetiap table model
'import_export', # http://django-import-export.readthedocs.io
'tagging',
'smart_selects', # Berhubungan dengan popup, get dll
'bidiutils', # Context processor
'pipeline', # https://django-pipeline.readthedocs.io/en/latest/installation.html
'django_postgrespool', # Postgres Connection Pooling backend
'djangosecure',
'treewidget',
# 'sysconf',
# 'moderation', # or 'moderation.apps.ModerationConfig',,
'django_pg_current_timestamp',
'django.contrib.sitemaps',
'robots', # https://godjango.com/23-robots-and-sitemaps/
'filer', # https://django-filer.readthedocs.io/en/latest/installation.html
'autofixture', # https://pypi.org/project/django-autofixture/
'corsheaders', # https://www.techiediaries.com/django-cors/
'django_nose',
'redisboard',
'core_doc',
'crm_mstdata',
'globalmasters',
'hris',
'hris_mstdata',
'crm',
'homepage',
'product',
# 'placement',
'facultative',
'finance',
'docman',
'treaty',
]
# =========================================================================================
# =========================================================================================
# BACKEND SETUP =========================================================================
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'user_sessions.middleware.SessionMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'session_security.middleware.SessionSecurityMiddleware',
'x_forwarded_for.middleware.XForwardedForMiddleware',
'qinspect.middleware.QueryInspectMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
]
WSGI_APPLICATION = 'core.wsgi.application'
SESSION_ENGINE = 'user_sessions.backends.db'
SESSION_CACHE_ALIAS = "default"
ROOT_URLCONF = 'core.urls'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
]
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',
,
]
LOGGING =
'version': 1,
'disable_existing_loggers': False,
'handlers':
'console':
'class': 'logging.StreamHandler',
,
,
# 'loggers':
# 'django.db.backends':
# 'level': 'DEBUG',
# 'handlers': ['console'],
# ,
# 'qinspect':
# 'handlers': ['console'],
# 'level': 'DEBUG',
# 'propagate': True,
#
# ,
CACHES =
'default':
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'cachetable',
,
# CACHES =
# "default":
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/1",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient"
# ,
# "KEY_PREFIX": "brokr"
# ,
# 'select2':
# "BACKEND": "django_redis.cache.RedisCache",
# "LOCATION": "redis://127.0.0.1:6379/2",
# "OPTIONS":
# "CLIENT_CLASS": "django_redis.client.DefaultClient",
#
#
#
# SELECT2_CACHE_BACKEND = 'select2'
CACHE_TTL = 60 * 15
SESSION_COOKIE_AGE = 30 * 60 # 30 Menit
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
COMPRESS = True
COMPRESS_AUTO = True
COMPRESS_VERSION = True
COMPRESS_ENABLED = True
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
# =========================================================================================
# =========================================================================================
# FRONT END SETUP =========================================================================
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
'image_cropping.thumbnail_processors.crop_corners',
) + thumbnail_settings.THUMBNAIL_PROCESSORS
THUMBNAIL_ALIASES =
'':
'avatar': 'size': (50, 50), 'crop': True,
,
THUMBNAIL_HIGH_RESOLUTION = True
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': False,
'OPTIONS':
'debug': DEBUG,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'bidiutils.context_processors.bidi',
'django_admin_env_notice.context_processors.from_settings',
# 'context_processors.app_list',
],
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'apptemplates.Loader',
]),
],
,
,
]
DYNAMIC_PREFERENCES =
'MANAGER_ATTRIBUTE': 'preferences',
'REGISTRY_MODULE': 'dynamic_preferences_registry',
'ADMIN_ENABLE_CHANGELIST_FORM': False,
'SECTION_KEY_SEPARATOR': '__',
'ENABLE_CACHE': True,
'VALIDATE_NAMES': True,
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
LOGIN_URL = '/login/'
ADMIN_MEDIA_PREFIX = '/media/'
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "assets"),
)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
# 'compressor.finders.CompressorFinder',
'pipeline.finders.PipelineFinder',
)
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/assets/bower_components/'
BOWER_PATH = '/usr/bin/bower'
BOWER_INSTALLED_APPS = (
'jquery',
'underscore',
'markitup#1.1.14',
'mediaelement#2.22.0',
'blueimp-file-upload#9.12.5',
)
PIPELINE =
'PIPELINE_ENABLED': True,
'JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
'CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
JS_WRAPPER = "(function()stuff();%s)();"
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_CONFIGS =
'default':
'skin': 'moono-lisa',
'toolbar': [["Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Print"],
['NumberedList', 'BulletedList', "Indent", "Outdent", 'JustifyLeft',
'JustifyCenter','JustifyRight', 'JustifyBlock'],
["Image", "Table", "Link", "Unlink", "Anchor", "SectionLink",
"Subscript", "Superscript"], ['Undo', 'Redo'], ["Source"],
["Maximize"]],
'tabSpaces': 3,
'toolbarCanCollapse': True,
'width': 880,
,
CKEDITOR_ALLOW_NONIMAGE_FILES = False
# TABBED_ADMIN_USE_JQUERY_UI = True
# TABBED_ADMIN_JQUERY_UI_CSS = 'tabbed_admin/css/tabbed_grappelli_admin.css'
# TABBED_ADMIN_JQUERY_UI_JS = 'tabbed_admin/js/jquery-ui-1.11.4.min.js'
LOGIN_REDIRECT_URL = 'home'
LOGOUT_REDIRECT_URL = '/'
UPLOADFILE = '/files/'
STATIC_DEPS = True
# TAGGIT_CASE_INSENSITIVE = True
DEFAULT_FILER_SERVERS =
'private':
'main':
'ENGINE': 'filer.server.backends.default.DefaultServer',
,
'thumbnails':
'ENGINE': 'filer.server.backends.default.DefaultServer',
# =====================================================================================
# =====================================================================================
# DATABASE SETUP ======================================================================
DATABASES =
'default':
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'core',
'USER': 'postgres',
'PASSWORD': 'Kambing1',
'HOST': 'localhost',
'PORT': '5432',
'CONN_MAX_AGE': 60 * 10, # 10 minutes
'AUTOCOMMIT': True,
SOUTH_DATABASE_ADAPTERS =
'default': 'south.db.postgresql_psycopg2'
DATABASE_POOL_ARGS =
'max_overflow': 10,
'pool_size': 5,
'recycle': 300
# =========================================================================================
# =========================================================================================
# OTHER SETUP
VARNISH_MANAGEMENT_ADDRS = ('127.0.0.1:6082',)
es_formats.DATETIME_FORMAT = "Y-m-d H:i:s"
LANGUAGE_CODE = 'en-us'
LANGUAGE_BIDI = True
TIME_ZONE = 'Asia/Jakarta'
USE_I18N = True
USE_L10N = True
USE_TZ = True
SITE_ID = 1
GOOGLE_MAPS_API_KEY = 'AIzaSyD8BxyAFUwWxv2lUnFv06ekTakzTr3sl-E'
IMPORT_EXPORT_USE_TRANSACTIONS = True
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '316233965812-sjbuqlsaat19vesjo6fa44jrlidjit7d.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'ff-pKw85dbNjYxydjM5FTRxz'
# =========================================================================================
# =========================================================================================
# SECURTY UPDATE ========================================================================
X_FRAME_OPTIONS = 'DENY'
CORS_REPLACE_HTTPS_REFERER = False
HOST_SCHEME = "http://"
SECURE_PROXY_SSL_HEADER = None
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SECURE_HSTS_SECONDS = None
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_FRAME_DENY = False
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_HSTS_PRELOAD = True
# =========================================================================================
# =========================================================================================
# EMAIL SETUP =============================================================================
EMAIL_BACKEND = 'django_multiple_email_backends.backend.CombinedEmailBackend'
EMAIL_BACKEND_LIST = ['django.core.mail.backends.filebased.EmailBackend',
'django.core.mail.backends.smtp.EmailBackend']
EMAIL_FILE_PATH = os.path.join(BASE_DIR, "sent_emails")
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'jasawarung@gmail.com'
EMAIL_HOST_PASSWORD = 'cgkxqhzuyfatucor'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
CONTACT_US_EMAIL = 'jasawarung@gmail.com'
# =========================================================================================
# =========================================================================================
# DEBUG TOOLBAR ===========================================================================
def show_toolbar(request):
return True
DEBUG_TOOLBAR_CONFIG =
"SHOW_TOOLBAR_CALLBACK" : show_toolbar,
'DISABLE_PANELS':
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
,
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
CONFIG_DEFAULTS =
'RESULTS_CACHE_SIZE': 3,
'SHOW_COLLAPSED': True,
'SQL_WARNING_THRESHOLD': 100, # milliseconds
# =========================================================================================
# =========================================================================================
# THEME SETUP ============================================================================
GRAPPELLI_INDEX_DASHBOARD = 'core.dashboard.GlobalSetting'
GRAPPELLI_ADMIN_TITLE = 'BROKR PLATFORM'
GRAPPELLI_AUTOCOMPLETE_LIMIT = 20
GRAPPELLI_CLEAN_INPUT_TYPES = True
GRAPPELLI_SWITCH_USER = False
GRAPPELLI_SWITCH_USER_ORIGINAL = True
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
SESSION_EXPIRE_SECONDS = 3600 # 1 hour
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
def itemDate():
return datetime.date.today()
ADMIN_SHORTCUTS = [
'title': 'Date Now : ' + str(itemDate()),
'shortcuts': [
'title': 'Home',
'url': '/',
,
'title': 'Treaty',
'url': '/treaty/',
'icon': 'clipboard',
# 'count_new': 'core.utils.count_submission',
,
'title': 'Facultative',
'url': '/facultative/',
'icon': 'paperclip',
# 'count_new': 'core.utils.count_submission',
,
'title': 'CRM',
'url': '/crm/',
'icon': 'address-book',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Project',
# 'url': '/placement/',
# 'icon': 'folder',
# 'count_new': 'core.utils.count_submission',
# ,
'title': 'HRD',
'url': '/hris/',
'icon': 'users',
# 'count_new': 'core.utils.count_account',
,
'title': 'Financial & Accounting',
'url': '/finance/',
'icon': 'chart-pie',
# 'count_new': 'core.utils.count_account',
,
#
# 'title': 'Profile',
# 'url': '/hris/employeesadmin/',
# 'icon': 'user',
# ,
]
,
]
ADMIN_SHORTCUTS_SETTINGS =
'show_on_all_pages': True,
'hide_app_list': False,
'open_new_window': False,
CRISPY_TEMPLATE_PACK = 'uni_form'
APPEND_SLASH = False
LANGUAGES = (
('en', 'English'),
('pl', 'Polish'),
)
# MARKDOWN_DEUX_STYLES =
# "default":
# "extras":
# "code-friendly": None,
# ,
# "safe_mode": "escape",
# ,
#
# ROBOTS SETUP ============================================================================
ROBOTS_USE_SITEMAP = False
ROBOTS_SITEMAP_URLS = [
'http://103.105.98.211:8001/sitemap.xml',
]
ROBOTS_SITEMAP_VIEW_NAME = 'cached-sitemap'
ROBOTS_USE_HOST = False
ROBOTS_USE_SCHEME_IN_HOST = True
ROBOTS_CACHE_TIMEOUT = 60*60*24
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
CORS_ORIGIN_ALLOW_ALL = True
# EXPLORER_CONNECTIONS = 'Default': 'default', 'Pws': 'pws'
# EXPLORER_DEFAULT_CONNECTION = 'default'
# EXPLORER_TASKS_ENABLED = True
# EXPLORER_DEFAULT_ROWS = 5000
# EXPLORER_DATA_EXPORTERS = [('csv', 'explorer.exporters.CSVExporter'), ('excel', 'explorer.exporters.ExcelExporter'), ('json', 'explorer.exporters.JSONExporter')]
# EXPLORER_SQL_WHITELIST = ('CREATED', 'UPDATED', 'DELETED','REGEXP_REPLACE')
# EXPLORER_SQL_BLACKLIST = ('ALTER', 'RENAME ', 'DROP', 'TRUNCATE', 'INSERT INTO', 'UPDATE', 'REPLACE', 'DELETE', 'ALTER', 'CREATE TABLE', 'SCHEMA', 'GRANT', 'OWNER TO')
# EXPLORER_UNSAFE_RENDERING = True
# Whether the Query Inspector should do anything (default: False)
QUERY_INSPECT_ENABLED = True
# Whether to log the stats via Django logging (default: True)
QUERY_INSPECT_LOG_STATS = True
# Whether to add stats headers (default: True)
QUERY_INSPECT_HEADER_STATS = True
# Whether to log duplicate queries (default: False)
QUERY_INSPECT_LOG_QUERIES = True
# Whether to log queries that are above an absolute limit (default: None - disabled)
QUERY_INSPECT_ABSOLUTE_LIMIT = 100 # in milliseconds
# Whether to log queries that are more than X standard deviations above the mean query time (default: None - disabled)
QUERY_INSPECT_STANDARD_DEVIATION_LIMIT = 2
# Whether to include tracebacks in the logs (default: False)
QUERY_INSPECT_LOG_TRACEBACKS = True
# Project root (a list of directories, see below - default empty)
# QUERY_INSPECT_TRACEBACK_ROOTS = ['/path/to/my/django/project/']
ENVIRONMENT_NAME = "Production server"
ENVIRONMENT_COLOR = "#FF2222"
ENVIRONMENT_ADMIN_SELECTOR = "grp-header"
REDISBOARD_DETAIL_FILTERS = ['.*']
ADD_REVERSION_ADMIN=True
`
answered Mar 26 at 14:43
Rofi AreivRofi Areiv
43 bronze badges
43 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349831%2fproblem-when-start-django-with-gunicorn-how-to-fix-it%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
are you able to run the development server?
– JPG
Mar 26 at 4:28
add
import django;django.setup()code at the top of/home/rofi/demo.protek/core/core/wsgi.pyfile– Avinash Raj
Mar 26 at 5:05
Could you please share your
settings.pyfile and what you gave to theAUTH_USER_MODEL?– Devang Padhiyar
Mar 26 at 5:27
in my setting.py
AUTH_USER_MODEL = 'auth.User'– Rofi Areiv
Mar 26 at 14:38