Django Project Template

15 views
Skip to first unread message

dtdave

unread,
Sep 9, 2019, 12:20:43 PM9/9/19
to Django users
I have been using Django-cookiecutter to create my projects.

I have then decided that there was too much that I either didn't need or had  alternatives in particular having a single settings file using django-configurations.
The first project building from scratch worked fine so I decided to create a template and upload it to GitHub for future use.

This is when my problems began!

This is the structure of a simple project without any apps or separating environment variables for simplicities sake.

.
├── Pipfile
├── Pipfile.lock
├── manage.py
└── my_project
    ├── __init__.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py

I have amended the following files:
wsgi.py
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ my_project }}.settings')
manage.py
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ my_project }}.settings')
settings.py
ROOT_URLCONF = '{{ my_project }}.urls'
WSGI_APPLICATION = '{{ my_project }}.wsgi.application'

I have uploaded it to GitHub and designated it as a template.
The issue comes about when I try to use it.
I issue the following command:
django-admin.py startproject \
  --extension=py,md,env \
  project_name

When I open this project I find that the variable {{ my_project }} has not been pick up so for example the ROOT_URLCONF just shows .urls instead of project_name.urls and the situation is the same for the WSGI_APPLICATION and the same is true for the items in the settings.py

I am sure that the answer is both simple and obvious but for the life of me I cannot see the solution.

Any help or pointers would be gratefully received.
Thanks in advance

Reply all
Reply to author
Forward
0 new messages