feat(djinit/templates): Refine template placeholders for production and environment configuration files
Added conditional comment handling for database settings in production template, introduced DATABASE_URL generation in env_sample, and corrected readme structure rendering. New Features - Added conditional comment handling for `use_database_url` and `database_type` in production settings. - Added `DATABASE_URL` template logic for MySQL and PostgreSQL in env_sample. - Updated `readme.md` template to properly render unified_structure sections. Enhancements - Ensured comment syntax consistency across all template files. - Streamlined placeholder usage for clearer project scaffolding. Bug Fixes - Removed stray formatting characters from comment markers.
This commit is contained in:
4 files changed
+7
-7
No files matched your search
@@ -8,7 +8,7 @@ SECRET_KEY = env('SECRET_KEY')
|
||||
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[])
|
||||
|
||||
# Database
|
||||
# @IF use_database_url
|
||||
# @IF use_database_url
|
||||
# Using dj_database_url (recommended for production)
|
||||
DATABASES = {
|
||||
'default': env.db('DATABASE_URL')
|
||||
@@ -17,7 +17,7 @@ DATABASES = {
|
||||
# Using individual database parameters
|
||||
DATABASES = {
|
||||
'default': {
|
||||
# @IF database_type == 'mysql'
|
||||
# @IF database_type == 'mysql'
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'PORT': env('DB_PORT', default='3306'),
|
||||
# @ELSE
|
||||
|
||||
@@ -3,9 +3,9 @@ DJANGO_SETTINGS_MODULE=[[ project_name ]].settings.development
|
||||
SECRET_KEY= your-secret-key
|
||||
ALLOWED_HOSTS=api.your-domain.com,www.your-domain.com
|
||||
|
||||
# @IF use_database_url
|
||||
# @IF use_database_url
|
||||
# Database URL (recommended for production)
|
||||
# @IF database_type == 'mysql'
|
||||
# @IF database_type == 'mysql'
|
||||
DATABASE_URL=mysql://user:password@localhost:3306/[[ project_name ]]
|
||||
# @ELSE
|
||||
DATABASE_URL=postgres://user:password@localhost:5432/[[ project_name ]]
|
||||
|
||||
@@ -71,7 +71,7 @@ Run `just` to see all available commands, including:
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
# @IF predefined_structure
|
||||
# @IF predefined_structure
|
||||
[[ project_name ]]/
|
||||
├── [[ module_name ]]/
|
||||
│ ├── settings/
|
||||
@@ -118,7 +118,7 @@ Run `just` to see all available commands, including:
|
||||
├── Procfile
|
||||
├── runtime.txt
|
||||
└── README.md
|
||||
# @ELSEIF unified_structure
|
||||
# @ELSEIF unified_structure
|
||||
[[ project_name ]]/
|
||||
├── apps/
|
||||
│ ├── admin/
|
||||
|
||||
@@ -10,7 +10,7 @@ djangorestframework_simplejwt
|
||||
drf-spectacular
|
||||
django-cors-headers
|
||||
whitenoise
|
||||
# @IF database_type == 'mysql'
|
||||
# @IF database_type == 'mysql'
|
||||
mysqlclient
|
||||
# @ELSE
|
||||
psycopg[binary]
|
||||
|
||||
Reference in new issue
Block a user