Beispiel #1
0
    def test_path_class(self):

        root = Path(__file__, '..', is_file=True)
        root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
        self.assertEqual(root(), root_path)
        self.assertEqual(root.__root__, root_path)

        web = root.path('public')
        self.assertEqual(web(), os.path.join(root_path, 'public'))
        self.assertEqual(web('css'), os.path.join(root_path, 'public', 'css'))
Beispiel #2
0
    def test_path_class(self):

        root = Path(__file__, "..", is_file=True)
        root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
        self.assertEqual(root(), root_path)
        self.assertEqual(root.__root__, root_path)

        web = root.path("public")
        self.assertEqual(web(), os.path.join(root_path, "public"))
        self.assertEqual(web("css"), os.path.join(root_path, "public", "css"))
Beispiel #3
0
    def test_path_class(self):

        root = Path(__file__, '..', is_file=True)
        root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
        self.assertEqual(root(), root_path)
        self.assertEqual(root.__root__, root_path)

        web = root.path('public')
        self.assertEqual(web(), os.path.join(root_path, 'public'))
        self.assertEqual(web('css'), os.path.join(root_path, 'public', 'css'))
Beispiel #4
0
from . import ENV
from environ import Path

# GENERAL

ROOT_DIR = Path(__file__) - 3
APPS_DIR = ROOT_DIR.path('backend')
TEMPLATES_DIR = ROOT_DIR.path('frontend', 'templates')
COMPONENTS_DIR = TEMPLATES_DIR.path('components')
ROOT_URLCONF = 'config.urls'

DEBUG = ENV.bool('DJANGO_DEBUG')
ADMIN_URL = ENV.str('DJANGO_ADMIN_URL')
SECRET_KEY = ENV.str('DJANGO_SECRET_KEY')
ALLOWED_HOSTS = ENV.list('DJANGO_ALLOWED_HOSTS')
SITE_URL = ENV.str('SITE_URL', ALLOWED_HOSTS[0])

DATABASES = {'default': ENV.db('DATABASE_URL')}
DATABASES['default']['ATOMIC_REQUESTS'] = True

TIME_ZONE = ENV.str('TZ', 'UTC')
LANGUAGE_CODE = 'ru-ru'
USE_I18N = True
USE_L10N = False
USE_TZ = True

VERSION = ENV.str('VERSION', 'none')

# APPS

INSTALLED_APPS = [
Beispiel #5
0
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from __future__ import absolute_import
from environ import Path, Env

#####################################
# LOCAL VARS
#####################################

ROOT_DIR = Path(__file__) - 2
APPS_DIR = ROOT_DIR.path('apps')
environ = Env()

#####################################
# SECURITY SETTINGS
#####################################

SECRET_KEY = environ('DJANGO_SECRET_KEY', default='CHANGEME!!!')

DEBUG = environ.bool('DJANGO_DEBUG', False)

ALLOWED_HOSTS = environ.list('DJANGO_ALLOWED_HOSTS',
                             default=['www.yourdomain.com'])

#####################################
# INSTALLED APPS
Beispiel #6
0
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = "/static/"

# Additional locations of static files
STATICFILES_DIRS = (str(root.path("static_source")),)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
)

MIDDLEWARE = (
    "django.middleware.security.SecurityMiddleware",
    "corsheaders.middleware.CorsMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
Beispiel #7
0
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django_htmx.middleware.HtmxMiddleware",
    "django.middleware.locale.LocaleMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.common.BrokenLinkEmailsMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
    "{{cookiecutter.repo_name}}.util.middleware.HTMXMessageMiddleware",
]

# STATIC
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#static-root
STATIC_ROOT = root.path("static")
# https://docs.djangoproject.com/en/dev/ref/settings/#static-url
STATIC_URL = "/static/"
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = (str(root.path("static_source")), )
# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = [
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
]

DJANGO_VITE_ASSETS_PATH = root.path("static")
DJANGO_VITE_DEV_MODE = DEBUG

# MEDIA
# ------------------------------------------------------------------------------