Re: [Django] #33650: Update startproject template with config directory

14 views
Skip to first unread message

Django

unread,
Apr 28, 2022, 3:34:43 PM4/28/22
to django-...@googlegroups.com
#33650: Update startproject template with config directory
-------------------------------------+-------------------------------------
Reporter: Timothy Allen | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: startproject, | Triage Stage:
template | Someday/Maybe
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by John Speno):

* cc: John Speno (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 13, 2023, 10:58:25 PM9/13/23
to django-...@googlegroups.com
#33650: Update startproject template with config directory
-------------------------------------+-------------------------------------
Reporter: Timothy Allen | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: startproject, | Triage Stage:
template | Someday/Maybe
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by lauryfriese):

To update the Django `startproject` template to include a `config`
directory, you can follow these steps:

1. Open your terminal or command prompt.

2. Create a new Django project using the `startproject` command. For
example:
```
django-admin startproject myproject
```
This will create a new Django project in a directory named `myproject`.

3. Navigate to the root directory of your Django project:
```
cd myproject
```

4. Create a new directory named `config` within your project directory:
```
mkdir config
```

5. Move the project-level configuration files (such as `settings.py`,
`urls.py`, etc.) into the `config` directory:
```
mv manage.py myproject/ config/
mv myproject/settings.py config/
mv myproject/urls.py config/
```

6. Update the `manage.py` file to reflect the new location of the
`settings.py` module. Open the `manage.py` file and change the line:
```python
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
```
to:
```python
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
```

7. Update the `wsgi.py` file within the `config` directory to reflect the
new location of the `settings.py` module. Open the `config/wsgi.py` file
and change the line:
```python
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
```
to:
```python
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
```

8. Update the `asgi.py` file within the `config` directory to reflect the
new location of the `settings.py` module. Open the `config/asgi.py` file
and change the line:
```python
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
```
to:
```python
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
```

9. Finally, update your project-level `.gitignore` file (if using version
control) to exclude the `myproject` directory, as it is no longer used:
```
# .gitignore
myproject/
```

With these steps, you have updated the Django `startproject` template to
include a `config` directory and reorganized the project-level
configuration files accordingly. Remember to adjust any import statements
or file references in your codebase accordingly to reflect the updated
file locations.

--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:3>

Django

unread,
Jan 13, 2024, 8:17:55 PM1/13/24
to django-...@googlegroups.com
#33650: Update startproject template with config directory
-------------------------------------+-------------------------------------
Reporter: Timothy Allen | Owner: Salaah
Type: | Amin
Cleanup/optimization | Status: assigned

Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: startproject, | Triage Stage:
template | Someday/Maybe
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Salaah Amin):

* owner: nobody => Salaah Amin
* status: new => assigned

Django

unread,
Jan 14, 2024, 12:12:18 AM1/14/24
to django-...@googlegroups.com
#33650: Update startproject template with config directory
-------------------------------------+-------------------------------------
Reporter: Timothy Allen | Owner: Salaah
Type: | Amin
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: startproject, | Triage Stage: Ready for
template | checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Salaah Amin):

* cc: Salaah Amin (added)
* stage: Someday/Maybe => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:4>

Django

unread,
Jan 14, 2024, 12:14:06 AM1/14/24
to django-...@googlegroups.com
#33650: Update startproject template with config directory
-------------------------------------+-------------------------------------
Reporter: Timothy Allen | Owner: Salaah
Type: | Amin
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: startproject, | Triage Stage: Accepted
template |

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Salaah Amin):

* stage: Ready for checkin => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:5>

Django

unread,
Jan 14, 2024, 2:41:56 AM1/14/24
to django-...@googlegroups.com
#33650: Update startproject template with config directory
-------------------------------------+-------------------------------------
Reporter: Timothy Allen | Owner: (none)
Type: | Status: new
Cleanup/optimization |

Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: startproject, | Triage Stage:
template | Someday/Maybe
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Salaah Amin => (none)
* status: assigned => new
* has_patch: 1 => 0
* stage: Accepted => Someday/Maybe


Comment:

Please don't accept tickets, for which discussion has been requested.

--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:6>

Django

unread,
Mar 19, 2024, 12:52:46 AM3/19/24
to django-...@googlegroups.com
#33650: Update startproject template with config directory
-------------------------------------+-------------------------------------
Reporter: Timothy Allen | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: startproject, | Triage Stage:
template | Someday/Maybe
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:7>
Reply all
Reply to author
Forward
0 new messages