Skip to content

Commit

Permalink
template: Convert project to template
Browse files Browse the repository at this point in the history
Use curly braces for project_name, so that it's automatically replaced
with the project name on project generation.
  • Loading branch information
laymonage committed Oct 1, 2020
1 parent 79d1bbc commit 5a1f2da
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tnd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: python manage.py collectstatic --no-input
- name: Run unit tests
run: |
coverage run --parallel --include="./*" --omit="manage.py,project_name/*" \
coverage run --parallel --include="./*" --omit="manage.py,{{ project_name }}/*" \
manage.py test --exclude-tag=functional
- name: Upload unit test coverage
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
run: python manage.py collectstatic --no-input
- name: Run functional tests
run: |
coverage run --parallel --include="./*" --omit="manage.py,project_name/*" \
coverage run --parallel --include="./*" --omit="manage.py,{{ project_name }}/*" \
manage.py test --tag=functional
- name: Upload functional test coverage
uses: actions/upload-artifact@v2
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ UnitTest:
before_script:
- *django_before_script
script:
- coverage run --parallel --include="./*" --omit="manage.py,project_name/*"
- coverage run --parallel --include="./*" --omit="manage.py,{{ project_name }}/*"
manage.py test --exclude-tag=functional

FunctionalTest:
Expand All @@ -43,7 +43,7 @@ FunctionalTest:
- apt-get update -q && apt-get install -yq chromium-driver
- *django_before_script
script:
- coverage run --parallel --include="./*" --omit="manage.py,project_name/*"
- coverage run --parallel --include="./*" --omit="manage.py,{{ project_name }}/*"
manage.py test --tag=functional


Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
migrate: python manage.py migrate
web: gunicorn project_name.wsgi
web: gunicorn {{ project_name }}.wsgi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# django-template-heroku
# {{ project_name }}

[![Test and Deploy][actions-badge]][commits-gh]
[![pipeline status][pipeline-badge]][commits-gl]
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
4 changes: 2 additions & 2 deletions project_name/asgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
ASGI config for project_name project.
ASGI config for {{ project_name }} project.
It exposes the ASGI callable as a module-level variable named ``application``.
Expand All @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')

application = get_asgi_application()
6 changes: 3 additions & 3 deletions project_name/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Django settings for project_name project.
Django settings for {{ project_name }} project.
Generated by 'django-admin startproject' using Django 3.1.1.
Expand Down Expand Up @@ -71,7 +71,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'project_name.urls'
ROOT_URLCONF = '{{ project_name }}.urls'

TEMPLATES = [
{
Expand All @@ -91,7 +91,7 @@
},
]

WSGI_APPLICATION = 'project_name.wsgi.application'
WSGI_APPLICATION = '{{ project_name }}.wsgi.application'


# Database
Expand Down
2 changes: 1 addition & 1 deletion project_name/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""project_name URL Configuration
"""{{ project_name }} URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Expand Down
4 changes: 2 additions & 2 deletions project_name/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
WSGI config for project_name project.
WSGI config for {{ project_name }} project.
It exposes the WSGI callable as a module-level variable named ``application``.
Expand All @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')

application = get_wsgi_application()

0 comments on commit 5a1f2da

Please sign in to comment.