diff --git a/README.md b/README.md index 88904ca..af0f2ae 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,24 @@ # Django Template -This repository contains a reusable Django project template in -`django_template/`. The existing sample project remains available at the -repository root and is not used as the template source. +This repository contains a reusable Django project template at the repository +root. ## Usage From the directory that contains this repository, create a new project with: ```bash -django-admin startproject myproject --template=djangotemplate/django_template +django-admin startproject myproject --template=djangotemplate ``` ``` -django-admin startproject myproject \ - --template=https://gitea.ta1sph.info/suphicakir/django-template-v2/archive/main.zip +django-admin startproject myproject --template=https://gitea.ta1sph.info/suphicakir/django-template-v2/archive/main.zip ``` For this repository's virtual environment, use: ```bash djangotemplate/env/bin/django-admin startproject myproject \ - --template=djangotemplate/django_template + --template=djangotemplate ``` Then initialize and run the generated project: diff --git a/django_template/README.md b/django_template/README.md deleted file mode 100644 index af3135a..0000000 --- a/django_template/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Django Project Template - -This directory is a reusable template for `django-admin startproject`. - -## Create a project - -From the directory that contains this repository, run: - -```bash -django-admin startproject myproject --template=djangotemplate/django_template -``` - -Then start the development server: - -```bash -cd myproject -python manage.py migrate -python manage.py runserver -``` - -## Included structure - -- `project_name/`: Django project settings, URL configuration, ASGI, and WSGI modules. Django replaces this directory name with the name supplied to `startproject`. -- `apps/core/`: A starter application with an index route and template. -- `templates/`: Project-level base template. -- `static/`: Project-level CSS, JavaScript, fonts, and images directories. -- `media/`: Development media upload directory. - -Add applications, environment-specific settings, static assets, and deployment configuration for each new project as needed. \ No newline at end of file diff --git a/django_template/apps/core/admin.py b/django_template/apps/core/admin.py deleted file mode 100644 index 0ed20cd..0000000 --- a/django_template/apps/core/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register models here. \ No newline at end of file diff --git a/django_template/apps/core/apps.py b/django_template/apps/core/apps.py deleted file mode 100644 index bea492a..0000000 --- a/django_template/apps/core/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class CoreConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'apps.core' \ No newline at end of file diff --git a/django_template/apps/core/models.py b/django_template/apps/core/models.py deleted file mode 100644 index 2503b27..0000000 --- a/django_template/apps/core/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Define models here. \ No newline at end of file diff --git a/django_template/apps/core/templates/apps/core/index.html b/django_template/apps/core/templates/apps/core/index.html deleted file mode 100644 index 33a69df..0000000 --- a/django_template/apps/core/templates/apps/core/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'Baselayout.html' %} - -{% block title %}Home{% endblock %} - -{% block content %} -Welcome to your Django project. -{% endblock %} \ No newline at end of file diff --git a/django_template/apps/core/tests.py b/django_template/apps/core/tests.py deleted file mode 100644 index f688862..0000000 --- a/django_template/apps/core/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Write tests here. \ No newline at end of file diff --git a/django_template/apps/core/urls.py b/django_template/apps/core/urls.py deleted file mode 100644 index 35f595f..0000000 --- a/django_template/apps/core/urls.py +++ /dev/null @@ -1,8 +0,0 @@ -from django.urls import path - -from . import views - - -urlpatterns = [ - path('', views.IndexView.as_view(), name='index'), -] \ No newline at end of file diff --git a/django_template/apps/core/views.py b/django_template/apps/core/views.py deleted file mode 100644 index fa23806..0000000 --- a/django_template/apps/core/views.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.views.generic import TemplateView - - -class IndexView(TemplateView): - template_name = 'apps/core/index.html' \ No newline at end of file diff --git a/django_template/manage.py b/django_template/manage.py deleted file mode 100644 index c656995..0000000 --- a/django_template/manage.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -"""Django's command-line utility for administrative tasks.""" -import os -import sys - - -def main(): - """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings') - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc - execute_from_command_line(sys.argv) - - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/django_template/project_name/asgi.py b/django_template/project_name/asgi.py deleted file mode 100644 index 5dcc8d8..0000000 --- a/django_template/project_name/asgi.py +++ /dev/null @@ -1,10 +0,0 @@ -"""ASGI config for {{ project_name }} project.""" - -import os - -from django.core.asgi import get_asgi_application - - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings') - -application = get_asgi_application() \ No newline at end of file diff --git a/django_template/project_name/settings.py b/django_template/project_name/settings.py deleted file mode 100644 index b50dbdc..0000000 --- a/django_template/project_name/settings.py +++ /dev/null @@ -1,84 +0,0 @@ -"""Django settings for {{ project_name }} project.""" - -import os -from pathlib import Path - - -BASE_DIR = Path(__file__).resolve().parent.parent - -SECRET_KEY = 'django-insecure-change-me-in-production' -DEBUG = True -ALLOWED_HOSTS = [] - -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'apps.core', -] - -MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -] - -ROOT_URLCONF = '{{ project_name }}.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [BASE_DIR / 'templates'], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, - }, -] - -WSGI_APPLICATION = '{{ project_name }}.wsgi.application' - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } -} - -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - -LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' -USE_I18N = True -USE_TZ = True - -STATIC_URL = 'static/' -STATICFILES_DIRS = [BASE_DIR / 'static'] -MEDIA_URL = 'media/' -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') - -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' \ No newline at end of file diff --git a/django_template/project_name/urls.py b/django_template/project_name/urls.py deleted file mode 100644 index da5acbb..0000000 --- a/django_template/project_name/urls.py +++ /dev/null @@ -1,15 +0,0 @@ -"""URL configuration for {{ project_name }} project.""" - -from django.conf import settings -from django.conf.urls.static import static -from django.contrib import admin -from django.urls import include, path - - -urlpatterns = [ - path('admin/', admin.site.urls), - path('', include('apps.core.urls')), -] - -if settings.DEBUG: - urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/django_template/project_name/wsgi.py b/django_template/project_name/wsgi.py deleted file mode 100644 index b96fdd1..0000000 --- a/django_template/project_name/wsgi.py +++ /dev/null @@ -1,10 +0,0 @@ -"""WSGI config for {{ project_name }} project.""" - -import os - -from django.core.wsgi import get_wsgi_application - - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings') - -application = get_wsgi_application() \ No newline at end of file diff --git a/django_template/static/css/styles.css b/django_template/static/css/styles.css deleted file mode 100644 index 082990e..0000000 --- a/django_template/static/css/styles.css +++ /dev/null @@ -1,10 +0,0 @@ -body { - margin: 0; - font-family: sans-serif; -} - -.container { - margin: 0 auto; - max-width: 960px; - padding: 2rem; -} \ No newline at end of file diff --git a/django_template/templates/Baselayout.html b/django_template/templates/Baselayout.html deleted file mode 100644 index c1a03b6..0000000 --- a/django_template/templates/Baselayout.html +++ /dev/null @@ -1,15 +0,0 @@ -{% load static %} - - -
- - - -