template proje hazır.

template proje hazır.
This commit is contained in:
2026-08-27 01:18:07 +03:00
parent 8efdbcd1e3
commit 4b8140bf5c
9 changed files with 80 additions and 61 deletions
+20 -2
View File
@@ -16,8 +16,26 @@ Bu depo, yeni Django projelerine standart, hızlı ve temiz bir şekilde başlam
## 📦 Kullanım
Yepyeni bir projeye başlamak için terminalinizi açın, sanal ortamınızı aktif edin ve aşağıdaki komutu çalıştırın:
Yepyeni bir projeye başlamak için terminalinizi açın, sanal ortamınızı aktif edin ve aşağıdaki komutlardan birini çalıştırın:
```bash
# Gitea üzerinden doğrudan proje oluşturmak için:
django-admin startproject --template=[https://gitea.ta1sph.info/suphicakir/django-template/archive/main.zip](https://gitea.ta1sph.info/suphicakir/django-template/archive/main.zip) --extension py,html proje_adi
django-admin startproject --template=https://gitea.ta1sph.info/suphicakir/django-template/archive/main.zip --extension py,html proje_adi
```
```bash
# Yerel diskteki bu depodan proje oluşturmak için:
django-admin startproject --template=/path/to/djtemplate --extension py,html proje_adi
```
Komut tamamlandığında `proje_adi/` dizini oluşur; `project_name` olarak adlandırılmış paket dizini ve içindeki tüm `.py`/`.html` dosyaları otomatik olarak `proje_adi` ile değiştirilir. `SECRET_KEY` de otomatik olarak yeni ve rastgele bir değerle doldurulur.
Ardından:
```bash
cd proje_adi
python -m venv venv && source venv/bin/activate
pip install django
python manage.py migrate
python manage.py runserver
```
+7 -8
View File
@@ -1,9 +1,8 @@
{% extends 'BaseLayout.html' %}
{% load static %}
{% block title %}{{ project_name }} Django Template{% endblock %}
{% block content %}
<!-- Ana İçerik (Hero Section) -->
<main class="flex-shrink-0">
{% templatetag openblock %} extends 'BaseLayout.html' {% templatetag closeblock %}
{% templatetag openblock %} block title {% templatetag closeblock %}{{ project_name }} Django Template{% templatetag openblock %} endblock {% templatetag closeblock %}
{% templatetag openblock %} block content {% templatetag closeblock %}
<!-- Ana İçerik (Hero Section) -->
<main class="flex-shrink-0">
<div class="container mt-5">
<div class="p-5 text-center bg-white rounded-3 shadow-sm border">
<h1 class="text-primary fw-bold">Hoş Geldiniz!</h1>
@@ -45,5 +44,5 @@
</div>
</div>
</div>
</main>
{% endblock %}
</main>
{% templatetag openblock %} endblock {% templatetag closeblock %}
+3 -2
View File
@@ -1,12 +1,13 @@
#!/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', 'djtemplate.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@@ -18,5 +19,5 @@ def main():
execute_from_command_line(sys.argv)
if __name__ == '__main__':
if __name__ == "__main__":
main()
+2 -2
View File
@@ -1,5 +1,5 @@
"""
ASGI config for djtemplate project.
ASGI config for {{ project_name }} project.
It exposes the ASGI callable as a module-level variable named ``application``.
@@ -11,6 +11,6 @@ import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djtemplate.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
application = get_asgi_application()
@@ -1,5 +1,5 @@
"""
Django settings for djtemplate project.
Django settings for {{ project_name }} project.
Generated by 'django-admin startproject' using Django 6.1.
@@ -20,7 +20,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/6.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-_3$kss#j69u95_#phki3x1+s^tf(1d1-59u-=bp&tovlyuuk2j"
SECRET_KEY = "{{ secret_key }}"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -50,7 +50,7 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "djtemplate.urls"
ROOT_URLCONF = "{{ project_name }}.urls"
TEMPLATES = [
{
@@ -67,7 +67,7 @@ TEMPLATES = [
},
]
WSGI_APPLICATION = "djtemplate.wsgi.application"
WSGI_APPLICATION = "{{ project_name }}.wsgi.application"
# Database
+1 -1
View File
@@ -1,5 +1,5 @@
"""
URL configuration for djtemplate project.
URL configuration for {{ project_name }} project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/6.1/topics/http/urls/
+2 -2
View File
@@ -1,5 +1,5 @@
"""
WSGI config for djtemplate project.
WSGI config for {{ project_name }} project.
It exposes the WSGI callable as a module-level variable named ``application``.
@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djtemplate.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
application = get_wsgi_application()
+8 -7
View File
@@ -1,15 +1,16 @@
{% load static %}
{% templatetag openblock %} load static {% templatetag closeblock %}
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Django değişkeni: Proje adını sekme başlığı yapar -->
<title>{% block title %}{{ project_name }}{% endblock %}</title>
<title>{% templatetag openblock %} block title {% templatetag closeblock %}{{ project_name }}{% templatetag openblock %} endblock {% templatetag closeblock %}</title>
<!-- Bootstrap 5 CSS (CDN) -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% templatetag openblock %} static 'css/bootstrap.min.css' {% templatetag closeblock %}"
rel="stylesheet">
<!-- İsteğe bağlı kendi CSS dosyan için hazırlık -->
<!-- <link rel="stylesheet" href="{% static 'css/style.css' %}"> -->
<!-- <link rel="stylesheet" href="{% templatetag openblock %} static 'css/style.css' {% templatetag closeblock %}"> -->
</head>
<body class="d-flex flex-column min-vh-100 bg-light">
<!-- Üst Navigasyon Çubuğu (Navbar) -->
@@ -40,7 +41,7 @@
</div>
</div>
</nav>
{% block content %}{% endblock %}
{% templatetag openblock %} block content {% templatetag closeblock %}{% templatetag openblock %} endblock {% templatetag closeblock %}
<!-- Alt Kısım (Footer) -->
<footer class="footer mt-auto py-3 bg-white border-top">
<div class="container text-center">
@@ -50,8 +51,8 @@
</div>
</footer>
<!-- Bootstrap 5 JS (CDN) -->
<script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
<script src="{% templatetag openblock %} static 'js/bootstrap.bundle.min.js' {% templatetag closeblock %}"></script>
<!-- İsteğe bağlı kendi JS dosyan için hazırlık -->
<!-- <script src="{% static 'js/main.js' %}"></script> -->
<!-- <script src="{% templatetag openblock %} static 'js/main.js' {% templatetag closeblock %}"></script> -->
</body>
</html>