You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Пилипенко Андрей Борисович a7eae2bb63 перенос в папку 11 months ago
..
api redux shop response 11 months ago
consts frontend 11 months ago
server slice 11 months ago
settings redux 11 months ago
static frontend 11 months ago
templates frontend 11 months ago
tests slice 11 months ago
type frontend 11 months ago
utils redux shop response 11 months ago
Dockerfile frontend 11 months ago
README.md frontend 11 months ago
__init__.py frontend 11 months ago
manage.py frontend 11 months ago
requirements.txt frontend 11 months ago

README.md

Deploy with Vercel

Django and Vercel

This example shows how to use Django 4 on Vercel with Serverless Functions using the Python Runtime. Version 1.0.0

Demo5

https://django-template.vercel.app/

How it Works

Our Django application, example is configured as an installed application in vercel_app/settings.py:

# vercel_app/settings.py
INSTALLED_APPS = [
    # ...
    'django_app',
]

We allow "*.vercel.app" subdomains in ALLOWED_HOSTS, in addition to 127.0.0.1:

# vercel_app/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:

# vercel_app/wsgi.py
app = get_wsgi_application()

The corresponding WSGI_APPLICATION setting is configured to use the app variable from the vercel_app.wsgi module:

# vercel_app/settings.py
WSGI_APPLICATION = 'vercel_app.wsgi.app'

There is a single view which renders the current time in example/views.py:

# django_app/views.py
from datetime import datetime

from django.http import HttpResponse


def index(request):
    now = datetime.now()
    html = f'''
    <html>
        <body>
            <h1>Hello from Vercel!</h1>
            <p>The current time is { now }.</p>
        </body>
    </html>
    '''
    return HttpResponse(html)

This view is exposed a URL through example/urls.py:

# django_app/urls.py
from django.urls import path

from django_app.views import index

urlpatterns = [
    path('', index),
]

Finally, it's made accessible to the Django server inside vercel_app/urls.py:

# vercel_app/urls.py
from django.urls import path, include

urlpatterns = [
    ...
    path('', include('django_app.urls')),
]

This example uses the Web Server Gateway Interface (WSGI) with Django to enable handling requests on Vercel with Serverless Functions.

Running Locally


python manage.py collectstatic
python manage.py runserver 8080

docker rmi -f <image_id>

docker compose down && docker compose build --no-cache && docker compose up

Docker: https://sematext.com/blog/docker-logs-location/
UI: https://docs.sencha.com/touch/2.3.1/#!/api
Localhost: https://letsencrypt.org/ru/docs/certificates-for-localhost/


ssh first@192.168.1.100
less +G /var/lib/docker/containers/<container_id>/<container_id>-json.log


https://c0.klipartz.com/pngpicture/54/511/gratis-png-meme-informacion-pegatina-telegrama-meme-thumbnail.png

Your Django application is now available at http://localhost:8000.

One-Click Deploy

Deploy the example using Vercel:

Deploy with Vercel