settings.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. """
  2. Django settings for bpconverter project.
  3. Generated by 'django-admin startproject' using Django 4.1.7.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/4.1/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/4.1/ref/settings/
  8. """
  9. from pathlib import Path
  10. import os
  11. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  12. BASE_DIR = Path(__file__).resolve().parent.parent
  13. # Quick-start development settings - unsuitable for production
  14. # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
  15. # SECURITY WARNING: keep the secret key used in production secret!
  16. SECRET_KEY = 'django-insecure-y%xo@^-@e9rg5e*ckd(0ma5jnv#91q1b-rm@!v$s251)rj8x(oqwery'
  17. # SECURITY WARNING: don't run with debug turned on in production!
  18. DEBUG = True
  19. #capture environment from google
  20. if 'ALLOWED' in os.environ:
  21. allowed_hosts = os.environ['ALLOWED'].split(',')
  22. ALLOWED_HOSTS = allowed_hosts
  23. # Application definition
  24. INSTALLED_APPS = [
  25. 'django.contrib.admin',
  26. 'django.contrib.auth',
  27. 'django.contrib.contenttypes',
  28. 'django.contrib.sessions',
  29. 'django.contrib.messages',
  30. 'django.contrib.staticfiles',
  31. 'frontpage',
  32. ]
  33. MIDDLEWARE = [
  34. 'django.middleware.security.SecurityMiddleware',
  35. 'django.contrib.sessions.middleware.SessionMiddleware',
  36. 'django.middleware.common.CommonMiddleware',
  37. 'django.middleware.csrf.CsrfViewMiddleware',
  38. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  39. 'django.contrib.messages.middleware.MessageMiddleware',
  40. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  41. ]
  42. ROOT_URLCONF = 'bpconverter.urls'
  43. TEMPLATES = [
  44. {
  45. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  46. 'DIRS': [ os.path.join(BASE_DIR,'static/basic'), ],
  47. 'APP_DIRS': True,
  48. 'OPTIONS': {
  49. 'context_processors': [
  50. 'django.template.context_processors.debug',
  51. 'django.template.context_processors.request',
  52. 'django.contrib.auth.context_processors.auth',
  53. 'django.contrib.messages.context_processors.messages',
  54. ],
  55. },
  56. },
  57. ]
  58. WSGI_APPLICATION = 'bpconverter.wsgi.application'
  59. # Database
  60. # https://docs.djangoproject.com/en/4.1/ref/settings/#databases
  61. DATABASES = {
  62. 'default': {
  63. 'ENGINE': 'django.db.backends.sqlite3',
  64. 'NAME': BASE_DIR / 'db.sqlite3',
  65. }
  66. }
  67. # Password validation
  68. # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
  69. AUTH_PASSWORD_VALIDATORS = [
  70. {
  71. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  72. },
  73. {
  74. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  75. },
  76. {
  77. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  78. },
  79. {
  80. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  81. },
  82. ]
  83. # Internationalization
  84. # https://docs.djangoproject.com/en/4.1/topics/i18n/
  85. LANGUAGE_CODE = 'it-it'
  86. TIME_ZONE = 'UTC'
  87. USE_I18N = True
  88. USE_TZ = True
  89. # Static files (CSS, JavaScript, Images)
  90. # https://docs.djangoproject.com/en/4.1/howto/static-files/
  91. STATIC_URL = 'static/'
  92. # Default primary key field type
  93. # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
  94. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  95. FORCE_SCRIPT_NAME='/bpconverter'
  96. MEDIA_ROOT=os.path.join(BASE_DIR,'static/upload')
  97. STATICFILES_DIRS = [ os.path.join(BASE_DIR,'static/upload/out'), ]