diff --git a/python/django/README.md b/python/django/README.md index 4096c8add9..3e81ff2d42 100644 --- a/python/django/README.md +++ b/python/django/README.md @@ -10,10 +10,10 @@ https://django-template.vercel.app/ ## How it Works -Our Django application, `example` is configured as an installed application in `vercel_app/settings.py`: +Our Django application, `example` is configured as an installed application in `api/settings.py`: ```python -# vercel_app/settings.py +# api/settings.py INSTALLED_APPS = [ # ... 'example', @@ -23,22 +23,22 @@ INSTALLED_APPS = [ We allow "\*.vercel.app" subdomains in `ALLOWED_HOSTS`, in addition to 127.0.0.1: ```python -# vercel_app/settings.py +# api/settings.py ALLOWED_HOSTS = ['127.0.0.1', '.vercel.app'] ``` The `wsgi` module must use a public variable named `app` to expose the WSGI application: ```python -# vercel_app/wsgi.py +# api/wsgi.py app = get_wsgi_application() ``` -The corresponding `WSGI_APPLICATION` setting is configured to use the `app` variable from the `vercel_app.wsgi` module: +The corresponding `WSGI_APPLICATION` setting is configured to use the `app` variable from the `api.wsgi` module: ```python -# vercel_app/settings.py -WSGI_APPLICATION = 'vercel_app.wsgi.app' +# api/settings.py +WSGI_APPLICATION = 'api.wsgi.app' ``` There is a single view which renders the current time in `example/views.py`: @@ -77,10 +77,10 @@ urlpatterns = [ ] ``` -Finally, it's made accessible to the Django server inside `vercel_app/urls.py`: +Finally, it's made accessible to the Django server inside `api/urls.py`: ```python -# vercel_app/urls.py +# api/urls.py from django.urls import path, include urlpatterns = [ diff --git a/python/django/vercel_app/__init__.py b/python/django/api/__init__.py similarity index 100% rename from python/django/vercel_app/__init__.py rename to python/django/api/__init__.py diff --git a/python/django/vercel_app/asgi.py b/python/django/api/asgi.py similarity index 73% rename from python/django/vercel_app/asgi.py rename to python/django/api/asgi.py index 0785a1fd21..8f60ecc6f5 100644 --- a/python/django/vercel_app/asgi.py +++ b/python/django/api/asgi.py @@ -1,5 +1,5 @@ """ -ASGI config for vercel_app project. +ASGI config for api project. It exposes the ASGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vercel_app.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings') application = get_asgi_application() diff --git a/python/django/vercel_app/settings.py b/python/django/api/settings.py similarity index 96% rename from python/django/vercel_app/settings.py rename to python/django/api/settings.py index c1711ee410..0c39dd5f61 100644 --- a/python/django/vercel_app/settings.py +++ b/python/django/api/settings.py @@ -1,5 +1,5 @@ """ -Django settings for vercel_app project. +Django settings for api project. Generated by 'django-admin startproject' using Django 4.1.3. @@ -50,7 +50,7 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -ROOT_URLCONF = 'vercel_app.urls' +ROOT_URLCONF = 'api.urls' TEMPLATES = [ { @@ -68,7 +68,7 @@ }, ] -WSGI_APPLICATION = 'vercel_app.wsgi.app' +WSGI_APPLICATION = 'api.wsgi.app' # Database diff --git a/python/django/vercel_app/urls.py b/python/django/api/urls.py similarity index 96% rename from python/django/vercel_app/urls.py rename to python/django/api/urls.py index 5d622fb0db..4810f2a444 100644 --- a/python/django/vercel_app/urls.py +++ b/python/django/api/urls.py @@ -1,4 +1,4 @@ -"""vercel_app URL Configuration +"""api URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.1/topics/http/urls/ diff --git a/python/django/vercel_app/wsgi.py b/python/django/api/wsgi.py similarity index 71% rename from python/django/vercel_app/wsgi.py rename to python/django/api/wsgi.py index f454698b69..f5e3ce54f2 100644 --- a/python/django/vercel_app/wsgi.py +++ b/python/django/api/wsgi.py @@ -1,5 +1,5 @@ """ -WSGI config for vercel_app project. +WSGI config for api project. It exposes the WSGI callable as a module-level variable named ``app``. @@ -11,6 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vercel_app.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings') app = get_wsgi_application() diff --git a/python/django/manage.py b/python/django/manage.py index d62bccf62c..8c45ccf303 100755 --- a/python/django/manage.py +++ b/python/django/manage.py @@ -6,7 +6,7 @@ def main(): """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vercel_app.settings') + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/python/django/vercel.json b/python/django/vercel.json index 231aef6bba..d17e5ce0ff 100644 --- a/python/django/vercel.json +++ b/python/django/vercel.json @@ -1,14 +1,8 @@ { - "builds": [ - { - "src": "vercel_app/wsgi.py", - "use": "@vercel/python" - } - ], "routes": [ { "src": "/(.*)", - "dest": "vercel_app/wsgi.py" + "dest": "api/wsgi.py" } ] }