* 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.
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>
* owner: nobody => Salaah Amin
* status: new => assigned
* cc: Salaah Amin (added)
* stage: Someday/Maybe => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:4>
* stage: Ready for checkin => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/33650#comment:5>
* 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>