# ... ] ACTSTREAM_SETTINGS = { # 'MANAGER': 'core.managers.MyActionManager', 'FETCH_RELATIONS': True, 'USE_PREFETCH': True, # 'USE_JSONFIELD': True, 'GFK_FETCH_DEPTH': 1, } REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.TokenAuthentication', # 'rest_framework.authentication.BasicAuthentication', ], 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.IsAuthenticated', ], } CORS_ALLOW_ALL_ORIGINS = True ACCOUNT_ACTIVATION_DAYS = 7 # you can choose this REGISTRATION_AUTO_LOGIN = True # logs in user when they register LOGIN_REDIRECT_URL = '/' # where user is sent after login # Configure Django App for Heroku. import django_on_heroku django_on_heroku.settings(locals()) del DATABASES['default']['OPTIONS']['sslmode']
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' django_on_heroku.settings(locals(), db_colors=False, databases=False, test_runner=False, staticfiles=True, allowed_hosts=True, logging=True, secret_key=False)
# https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ # https://dev.to/fazledyn/deploying-django-3-1-on-heroku-417 # https://github.com/pkrefta/django-on-heroku/blob/3b2367fec9417230dbfba0235353403865386a41/django_on_heroku/core.py#L106 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') os.makedirs(STATIC_ROOT, exist_ok=True) # Extra places for collectstatic to find static files. STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] # Configure Django App for Heroku. django_on_heroku.settings(locals(), test_runner=False, databases=False, staticfiles=True, logging=True)
LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'Iconicity', 'media') STATIC_ROOT = os.path.join(BASE_DIR, 'Iconicity', 'static') STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'Iconicity', 'static'), ) django_on_heroku.settings(locals()) # bottom of the file REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.BasicAuthentication', ] }
# Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ AUTH_USER_MODEL = "jwt_auth.User" REST_FRAMEWORK = { "DEFAULT_RENDERER_CLASSES": ( "djangorestframework_camel_case.render.CamelCaseJSONRenderer", "djangorestframework_camel_case.render.CamelCaseBrowsableAPIRenderer", ), "DEFAULT_PARSER_CLASSES": ( "djangorestframework_camel_case.parser.CamelCaseJSONParser", ), "DEFAULT_AUTHENTICATION_CLASSES": ["jwt_auth.authentication.JWTAuthentication"], } ROOT_URLCONF = "project.urls" STATIC_URL = "/static/" STATICFILES_DIRS = ( os.path.join(BASE_DIR, "client", "build", "static"), ) # django_on_heroku.settings(locals()) # put this last
{ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' using_geodjango = bool(os.environ.get('BUILD_WITH_GEO_LIBRARIES')) django_on_heroku.settings(locals(), geodjango=using_geodjango)
DEBUG_PROPAGATE_EXCEPTIONS = True LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", 'datefmt': "%d/%b/%Y %H:%M:%S" }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, 'handlers': { 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', }, }, 'loggers': { 'MYAPP': { 'handlers': ['console'], 'level': 'DEBUG', }, } } django_on_heroku.settings(locals(), staticfiles=False) del DATABASES['default']['OPTIONS']['sslmode']
}, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] MAX_UPLOAD_SIZE = "104857600" MEDIA_URL = '/images/' MEDIA_ROOT = os.path.join(BASE_DIR, "static/images") # Configure Django App for Heroku. django_on_heroku.settings(locals(), test_runner=False)
# https://django-storages.readthedocs.io/en/latest/backends/dropbox.html # https://learndjango.com/tutorials/django-file-and-image-uploads-tutorial MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') # REST Framework REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.IsAuthenticatedOrReadOnly', ] } # Configure Django App for Heroku. ON_HEROKU = os.environ.get("DYNO", "") != "" # Assumption: "DYNO" envvar wouldn't be set locally if ON_HEROKU: import django_on_heroku django_on_heroku.settings( locals(), allowed_hosts=False, # use a more restrictive value secret_key=False, # use a different env var name ) DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage' DROPBOX_OAUTH2_TOKEN = os.environ.get("DROPBOX_OAUTH2_TOKEN", "") DROPBOX_ROOT_PATH = os.environ.get("DROPBOX_ROOT_PATH", "upendo-dev") # Configuration for CORS CORS_ORIGIN_ALLOW_ALL = True
# Get emails from logs of class AdminEmailHandler ADMINS = [("Abhishek Chaudhuri", "*****@*****.**")] # Log all errors in production similar to debug mode LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'console': { 'class': 'logging.StreamHandler', }, }, 'root': { 'handlers': ['console'], 'level': 'WARNING', }, 'loggers': { 'django': { 'handlers': ['console'], 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'), 'propagate': False, }, }, } # Activate Django-on-Heroku (breaks if testing) if sys.argv[1:2] != ["test"]: # logging=False prevents LOGGING from being overwritten django_on_heroku.settings(locals(), logging=False)
REDIS FOR WEBSOCKETS """ REDIS_CONNECTION = os.getenv('REDIS_URL', None) CHANNEL_LAYERS = { "default": { 'BACKEND': "channels_redis.core.RedisChannelLayer", 'CONFIG': { 'hosts': [REDIS_CONNECTION] } } } DJANGO_CHANNELS_REST_API = { "DEFAULT_PERMISSION_CLASSES": ("djangochannelsrestframework.permissions.IsAuthenticated", ) } sentry_sdk.init( dsn= "https://[email protected]/5616873", integrations=[DjangoIntegration()], traces_sample_rate=1.0, send_default_pii=True) django_on_heroku.settings(locals(), staticfiles=False, secret_key=False, databases=True, allowed_hosts=False, logging=False)
LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' django_on_heroku.settings(locals()) #added for heroku #####email##### #EMAIL_BACKEND='django.core.mail.backends.console.EmailBackend' #email to console #google smtp EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_USE_TLS = True EMAIL_PORT = 587 EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER_ENVAR') EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD_ENVAR') #mailgun, sender, other sender