Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe9eec70d5 | ||
|
|
ad09fa0b79 | ||
|
|
5984961878 | ||
|
|
5b755b789c | ||
|
|
382d2a0f56 | ||
|
|
c38d4b3832 | ||
|
|
3200c9f9b2 | ||
|
|
fafe29c2cb | ||
|
|
9e3f5ead8f | ||
|
|
260d41b10d | ||
|
|
2d7d712ecf | ||
|
|
3ffd85d2ca | ||
|
|
8c1195880d | ||
|
|
c1262d02e9 | ||
|
|
63989b7f67 | ||
|
|
b3b0c660e6 | ||
|
|
3de5d577a1 | ||
|
|
e5f93e829b | ||
|
|
ce5cda9330 |
No files matched your search
@@ -16,7 +16,7 @@ jobs:
|
|||||||
python-version: ["3.13"]
|
python-version: ["3.13"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v4
|
uses: github/codeql-action/init@v4
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
use-github-auto-merge: true
|
use-github-auto-merge: true
|
||||||
target: minor
|
target: squash
|
||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ packages = ["src/djinit"]
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "djinitx"
|
name = "djinitx"
|
||||||
version = "0.3.5"
|
version = "0.3.6"
|
||||||
description = "A CLI tool to setup Django project"
|
description = "A CLI tool to setup Django project"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
questionary==2.1.1
|
questionary==2.1.1
|
||||||
rich==15.0.0
|
rich==15.0.0
|
||||||
# dev
|
# dev
|
||||||
ruff==0.15.14
|
ruff==0.15.18
|
||||||
pre-commit==4.6.0
|
pre-commit==4.6.0
|
||||||
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="djinitx",
|
name="djinitx",
|
||||||
version="0.3.5",
|
version="0.3.6",
|
||||||
description="A CLI tool to setup Django projects",
|
description="A CLI tool to setup Django projects",
|
||||||
long_description=open("README.md").read(),
|
long_description=open("README.md").read(),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ class FileCreator(BaseService):
|
|||||||
"project_name": self.project_name,
|
"project_name": self.project_name,
|
||||||
"api_module": api_module,
|
"api_module": api_module,
|
||||||
"include_api": True,
|
"include_api": True,
|
||||||
|
"use_tailwind": self.metadata.get("use_tailwind", False),
|
||||||
}
|
}
|
||||||
if comment_out_api:
|
if comment_out_api:
|
||||||
urls_context["comment_out_api_url"] = True
|
urls_context["comment_out_api_url"] = True
|
||||||
@@ -247,6 +248,7 @@ class FileCreator(BaseService):
|
|||||||
"app_names": effective_app_modules,
|
"app_names": effective_app_modules,
|
||||||
"include_apps": True,
|
"include_apps": True,
|
||||||
"include_api": True,
|
"include_api": True,
|
||||||
|
"use_tailwind": self.metadata.get("use_tailwind", False),
|
||||||
}
|
}
|
||||||
self._render_and_create_file(
|
self._render_and_create_file(
|
||||||
"urls.py",
|
"urls.py",
|
||||||
@@ -308,7 +310,13 @@ class FileCreator(BaseService):
|
|||||||
CommonUtils.create_file_from_template(
|
CommonUtils.create_file_from_template(
|
||||||
project_urls_path,
|
project_urls_path,
|
||||||
"config/urls.py-tpl",
|
"config/urls.py-tpl",
|
||||||
{"url_type": "project", "project_name": self.project_name, "api_module": "api", "include_api": True},
|
{
|
||||||
|
"url_type": "project",
|
||||||
|
"project_name": self.project_name,
|
||||||
|
"api_module": "api",
|
||||||
|
"include_api": True,
|
||||||
|
"use_tailwind": self.metadata.get("use_tailwind", False),
|
||||||
|
},
|
||||||
"Updated project urls.py to include API routes",
|
"Updated project urls.py to include API routes",
|
||||||
should_format=True,
|
should_format=True,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
"""generated with djinit"""
|
"""generated with djinit"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
import environ
|
import environ
|
||||||
from django.core.asgi import get_asgi_application
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
env_path = Path(__file__).resolve().parent.parent / ".env"
|
||||||
env = environ.Env()
|
env = environ.Env()
|
||||||
environ.Env.read_env()
|
environ.Env.read_env(env_path)
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE", default="[[ project_name ]].settings.production"))
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE", default="[[ project_name ]].settings.production"))
|
||||||
application = get_asgi_application()
|
application = get_asgi_application()
|
||||||
@@ -9,8 +9,9 @@ from pathlib import Path
|
|||||||
|
|
||||||
import environ
|
import environ
|
||||||
|
|
||||||
|
env_path = Path(__file__).resolve().parent.parent.parent / ".env"
|
||||||
env = environ.Env()
|
env = environ.Env()
|
||||||
environ.Env.read_env()
|
environ.Env.read_env(env_path)
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
"""generated with djinit"""
|
"""generated with djinit"""
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path, re_path
|
||||||
|
from django.conf import settings
|
||||||
|
from django.views.static import serve
|
||||||
# @IF include_api or include_apps
|
# @IF include_api or include_apps
|
||||||
from django.urls import include
|
from django.urls import include
|
||||||
# @ENDIF
|
# @ENDIF
|
||||||
# @IF include_api
|
# @IF include_api
|
||||||
from django.conf import settings
|
|
||||||
from drf_yasg.views import get_schema_view
|
from drf_yasg.views import get_schema_view
|
||||||
from drf_yasg import openapi
|
from drf_yasg import openapi
|
||||||
from rest_framework_simplejwt.views import (
|
from rest_framework_simplejwt.views import (
|
||||||
@@ -54,6 +55,22 @@ if settings.DEBUG:
|
|||||||
path("schema/", schema_view.with_ui("redoc", cache_timeout=0)),
|
path("schema/", schema_view.with_ui("redoc", cache_timeout=0)),
|
||||||
]
|
]
|
||||||
# @ENDIF
|
# @ENDIF
|
||||||
|
# @IF use_tailwind
|
||||||
|
|
||||||
|
# django-browser-reload for tailwind live reload (dev only)
|
||||||
|
if settings.DEBUG:
|
||||||
|
urlpatterns += [
|
||||||
|
path("__reload__/", include("django_browser_reload.urls")),
|
||||||
|
]
|
||||||
|
# @ENDIF
|
||||||
|
|
||||||
|
urlpatterns += [
|
||||||
|
re_path(
|
||||||
|
r"^media/(?P<path>.*)$",
|
||||||
|
serve,
|
||||||
|
{"document_root": settings.MEDIA_ROOT},
|
||||||
|
),
|
||||||
|
]
|
||||||
# @ENDIF
|
# @ENDIF
|
||||||
# @IF url_type == 'api_root'
|
# @IF url_type == 'api_root'
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
"""generated with djinit"""
|
"""generated with djinit"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
import environ
|
import environ
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
env_path = Path(__file__).resolve().parent.parent / ".env"
|
||||||
env = environ.Env()
|
env = environ.Env()
|
||||||
environ.Env.read_env()
|
environ.Env.read_env(env_path)
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE", default="[[ project_name ]].settings.production"))
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE", default="[[ project_name ]].settings.production"))
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,21 @@
|
|||||||
"""Django's command-line utility for administrative tasks."""
|
"""Django's command-line utility for administrative tasks."""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import environ
|
import environ
|
||||||
|
|
||||||
|
env_path = Path(__file__).resolve().parent / ".env"
|
||||||
|
env = environ.Env()
|
||||||
|
environ.Env.read_env(env_path)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", os.getenv("DJANGO_SETTINGS_MODULE", "[[ project_name ]].settings.production"))
|
os.environ.setdefault(
|
||||||
|
"DJANGO_SETTINGS_MODULE",
|
||||||
|
env("DJANGO_SETTINGS_MODULE", default="[[ project_name ]].settings.production"),
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ class DjangoHelper:
|
|||||||
"url_type": "project",
|
"url_type": "project",
|
||||||
"project_name": project_name,
|
"project_name": project_name,
|
||||||
"django_version": DjangoHelper.DJANGO_VERSION,
|
"django_version": DjangoHelper.DJANGO_VERSION,
|
||||||
|
"use_tailwind": metadata.get("use_tailwind", False),
|
||||||
}
|
}
|
||||||
project_files = [
|
project_files = [
|
||||||
("urls.py", "config/urls.py-tpl", urls_context),
|
("urls.py", "config/urls.py-tpl", urls_context),
|
||||||
|
|||||||
Reference in new issue
Block a user