mirror of
				https://github.com/cookiecutter/cookiecutter-django.git
				synced 2025-10-31 16:07:49 +03:00 
			
		
		
		
	Rename ROOT_DIR to BASE_DIR (#4086)
Co-authored-by: example <example@example.com> Fix https://github.com/cookiecutter/cookiecutter-django/issues/4075
This commit is contained in:
		
							parent
							
								
									cb99f0d211
								
							
						
					
					
						commit
						70014c2b45
					
				|  | @ -134,11 +134,11 @@ def _fixture_id(ctx): | |||
|     return "-".join(f"{key}:{value}" for key, value in ctx.items()) | ||||
| 
 | ||||
| 
 | ||||
| def build_files_list(root_dir): | ||||
| def build_files_list(base_dir): | ||||
|     """Build a list containing absolute paths to the generated files.""" | ||||
|     return [ | ||||
|         os.path.join(dirpath, file_path) | ||||
|         for dirpath, subdirs, files in os.walk(root_dir) | ||||
|         for dirpath, subdirs, files in os.walk(base_dir) | ||||
|         for file_path in files | ||||
|     ] | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,8 +15,8 @@ from django.core.asgi import get_asgi_application | |||
| 
 | ||||
| # This allows easy placement of apps within the interior | ||||
| # {{ cookiecutter.project_slug }} directory. | ||||
| ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent | ||||
| sys.path.append(str(ROOT_DIR / "{{ cookiecutter.project_slug }}")) | ||||
| BASE_DIR = Path(__file__).resolve(strict=True).parent.parent | ||||
| sys.path.append(str(BASE_DIR / "{{ cookiecutter.project_slug }}")) | ||||
| 
 | ||||
| # If DJANGO_SETTINGS_MODULE is unset, default to the local settings | ||||
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") | ||||
|  |  | |||
|  | @ -5,15 +5,15 @@ from pathlib import Path | |||
| 
 | ||||
| import environ | ||||
| 
 | ||||
| ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent | ||||
| BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent | ||||
| # {{ cookiecutter.project_slug }}/ | ||||
| APPS_DIR = ROOT_DIR / "{{ cookiecutter.project_slug }}" | ||||
| APPS_DIR = BASE_DIR / "{{ cookiecutter.project_slug }}" | ||||
| env = environ.Env() | ||||
| 
 | ||||
| READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False) | ||||
| if READ_DOT_ENV_FILE: | ||||
|     # OS environment variables take precedence over variables from .env | ||||
|     env.read_env(str(ROOT_DIR / ".env")) | ||||
|     env.read_env(str(BASE_DIR / ".env")) | ||||
| 
 | ||||
| # GENERAL | ||||
| # ------------------------------------------------------------------------------ | ||||
|  | @ -33,7 +33,7 @@ USE_I18N = True | |||
| # https://docs.djangoproject.com/en/dev/ref/settings/#use-tz | ||||
| USE_TZ = True | ||||
| # https://docs.djangoproject.com/en/dev/ref/settings/#locale-paths | ||||
| LOCALE_PATHS = [str(ROOT_DIR / "locale")] | ||||
| LOCALE_PATHS = [str(BASE_DIR / "locale")] | ||||
| 
 | ||||
| # DATABASES | ||||
| # ------------------------------------------------------------------------------ | ||||
|  | @ -159,7 +159,7 @@ MIDDLEWARE = [ | |||
| # STATIC | ||||
| # ------------------------------------------------------------------------------ | ||||
| # https://docs.djangoproject.com/en/dev/ref/settings/#static-root | ||||
| STATIC_ROOT = str(ROOT_DIR / "staticfiles") | ||||
| STATIC_ROOT = str(BASE_DIR / "staticfiles") | ||||
| # 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 | ||||
|  |  | |||
|  | @ -21,8 +21,8 @@ from django.core.wsgi import get_wsgi_application | |||
| 
 | ||||
| # This allows easy placement of apps within the interior | ||||
| # {{ cookiecutter.project_slug }} directory. | ||||
| ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent | ||||
| sys.path.append(str(ROOT_DIR / "{{ cookiecutter.project_slug }}")) | ||||
| BASE_DIR = Path(__file__).resolve(strict=True).parent.parent | ||||
| sys.path.append(str(BASE_DIR / "{{ cookiecutter.project_slug }}")) | ||||
| # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks | ||||
| # if running multiple sites in the same mod_wsgi process. To fix this, use | ||||
| # mod_wsgi daemon mode with each site in its own daemon process, or use | ||||
|  |  | |||
|  | @ -4,13 +4,13 @@ from pathlib import Path | |||
| 
 | ||||
| import pytest | ||||
| 
 | ||||
| ROOT_DIR_PATH = Path(__file__).parent.resolve() | ||||
| PRODUCTION_DOTENVS_DIR_PATH = ROOT_DIR_PATH / ".envs" / ".production" | ||||
| BASE_DIR_PATH = Path(__file__).parent.resolve() | ||||
| PRODUCTION_DOTENVS_DIR_PATH = BASE_DIR_PATH / ".envs" / ".production" | ||||
| PRODUCTION_DOTENV_FILE_PATHS = [ | ||||
|     PRODUCTION_DOTENVS_DIR_PATH / ".django", | ||||
|     PRODUCTION_DOTENVS_DIR_PATH / ".postgres", | ||||
| ] | ||||
| DOTENV_FILE_PATH = ROOT_DIR_PATH / ".env" | ||||
| DOTENV_FILE_PATH = BASE_DIR_PATH / ".env" | ||||
| 
 | ||||
| 
 | ||||
| def merge( | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user