mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-05 04:30:16 +03:00
Fix Ruff errors
This commit is contained in:
parent
288473d2bb
commit
0baa147eba
|
@ -1,4 +1,3 @@
|
||||||
# ruff: noqa
|
|
||||||
"""
|
"""
|
||||||
ASGI config for {{ cookiecutter.project_name }} project.
|
ASGI config for {{ cookiecutter.project_name }} project.
|
||||||
|
|
||||||
|
@ -25,12 +24,9 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||||
|
|
||||||
# This application object is used by any ASGI server configured to use this file.
|
# This application object is used by any ASGI server configured to use this file.
|
||||||
django_application = get_asgi_application()
|
django_application = get_asgi_application()
|
||||||
# Apply ASGI middleware here.
|
|
||||||
# from helloworld.asgi import HelloWorldApplication
|
|
||||||
# application = HelloWorldApplication(application)
|
|
||||||
|
|
||||||
# Import websocket application here, so apps from django_application are loaded first
|
# Import websocket application here, so apps from django_application are loaded first
|
||||||
from config.websocket import websocket_application
|
from config.websocket import websocket_application # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
async def application(scope, receive, send):
|
async def application(scope, receive, send):
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# ruff: noqa
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
@ -77,4 +76,7 @@ if settings.DEBUG:
|
||||||
if "debug_toolbar" in settings.INSTALLED_APPS:
|
if "debug_toolbar" in settings.INSTALLED_APPS:
|
||||||
import debug_toolbar
|
import debug_toolbar
|
||||||
|
|
||||||
urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns
|
urlpatterns = [
|
||||||
|
path("__debug__/", include(debug_toolbar.urls)),
|
||||||
|
*urlpatterns,
|
||||||
|
]
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# ruff: noqa
|
|
||||||
"""
|
"""
|
||||||
WSGI config for {{ cookiecutter.project_name }} project.
|
WSGI config for {{ cookiecutter.project_name }} project.
|
||||||
|
|
||||||
|
@ -25,16 +24,9 @@ from django.core.wsgi import get_wsgi_application
|
||||||
# {{ cookiecutter.project_slug }} directory.
|
# {{ cookiecutter.project_slug }} directory.
|
||||||
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
|
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
|
||||||
sys.path.append(str(BASE_DIR / "{{ cookiecutter.project_slug }}"))
|
sys.path.append(str(BASE_DIR / "{{ cookiecutter.project_slug }}"))
|
||||||
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
|
|
||||||
# if running multiple sites in the same mod_wsgi process. To fix this, use
|
|
||||||
# mod_wsgi daemon mode with each site in its own daemon process, or use
|
|
||||||
# os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.production"
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
|
||||||
|
|
||||||
# This application object is used by any WSGI server configured to use this
|
# This application object is used by any WSGI server configured to use this
|
||||||
# file. This includes Django's development server, if the WSGI_APPLICATION
|
# file. This includes Django's development server, if the WSGI_APPLICATION
|
||||||
# setting points here.
|
# setting points here.
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
# Apply WSGI middleware here.
|
|
||||||
# from helloworld.wsgi import HelloWorldApplication
|
|
||||||
# application = HelloWorldApplication(application)
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ruff: noqa
|
# ruff: noqa: ERA001, PTH100
|
||||||
# Configuration file for the Sphinx documentation builder.
|
# Configuration file for the Sphinx documentation builder.
|
||||||
#
|
#
|
||||||
# This file only contains a selection of the most common options. For a full
|
# This file only contains a selection of the most common options. For a full
|
||||||
|
@ -13,9 +13,10 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
|
||||||
if os.getenv("READTHEDOCS", default=False) == "True":
|
if os.getenv("READTHEDOCS", default="False") == "True":
|
||||||
sys.path.insert(0, os.path.abspath(".."))
|
sys.path.insert(0, os.path.abspath(".."))
|
||||||
os.environ["DJANGO_READ_DOT_ENV_FILE"] = "True"
|
os.environ["DJANGO_READ_DOT_ENV_FILE"] = "True"
|
||||||
os.environ["USE_DOCKER"] = "no"
|
os.environ["USE_DOCKER"] = "no"
|
||||||
|
@ -32,7 +33,7 @@ django.setup()
|
||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
project = "{{ cookiecutter.project_name }}"
|
project = "{{ cookiecutter.project_name }}"
|
||||||
copyright = """{% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}"""
|
copyright = """{% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}""" # noqa: A001
|
||||||
author = "{{ cookiecutter.author_name }}"
|
author = "{{ cookiecutter.author_name }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,22 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# ruff: noqa
|
"""Django's command-line utility for administrative tasks."""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
def main():
|
||||||
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
except ImportError:
|
except ImportError as exc:
|
||||||
# The above import may fail for some other reason. Ensure that the
|
raise ImportError( # noqa: TRY003
|
||||||
# issue is really that Django is missing to avoid masking other
|
"Couldn't import Django. Are you sure it's installed and " # noqa: EM101
|
||||||
# exceptions on Python 2.
|
"available on your PYTHONPATH environment variable? Did you "
|
||||||
try:
|
"forget to activate a virtual environment?",
|
||||||
import django
|
) from exc
|
||||||
except ImportError:
|
|
||||||
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?"
|
|
||||||
)
|
|
||||||
|
|
||||||
raise
|
|
||||||
|
|
||||||
# This allows easy placement of apps within the interior
|
# This allows easy placement of apps within the interior
|
||||||
# {{ cookiecutter.project_slug }} directory.
|
# {{ cookiecutter.project_slug }} directory.
|
||||||
|
@ -30,3 +24,7 @@ if __name__ == "__main__":
|
||||||
sys.path.append(str(current_path / "{{ cookiecutter.project_slug }}"))
|
sys.path.append(str(current_path / "{{ cookiecutter.project_slug }}"))
|
||||||
|
|
||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# ruff: noqa
|
|
||||||
import os
|
import os
|
||||||
from collections.abc import Sequence
|
from collections.abc import Sequence
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
Loading…
Reference in New Issue
Block a user