This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view: fiscal_calendar { | |
# Calculates the 4/4/5 fiscal calendar for all dates 2010-2050 | |
# Expected query duration <1 s | |
derived_table: { | |
interval_trigger: "720 hours" | |
indexes: ["calendar_date"] | |
sql: | |
select | |
calendar.date as calendar_date, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vercel-django-example/requirements.txt | |
# https://github.com/jayhale/vercel-django-example/blob/main/requirements.txt#L1 | |
Django==3.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vercel-django-example/vercel_app/settings.py | |
# https://github.com/jayhale/vercel-django-example/blob/main/vercel_app/settings.py#L28 | |
# ... | |
ALLOWED_HOSTS = ['.vercel.app'] # Allow *.vercel.app | |
# ... | |
DATABASES = {} # Prevent Django from loading an adapter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// vercel-django-example/vercel.json | |
// https://github.com/jayhale/vercel-django-example/blob/main/vercel.json#L1 | |
{ | |
"builds": [{ | |
"src": "vercel_app/wsgi.py", | |
"use": "@ardnt/vercel-python-wsgi", | |
"config": { "maxLambdaSize": "15mb" } | |
}], | |
"routes": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vercel-django-example/example/urls.py | |
# https://github.com/jayhale/vercel-django-example/blob/main/example/urls.py#L7 | |
from django.urls import path | |
from example.views import index | |
urlpatterns = [ | |
path('', index), | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vercel-django-example/example/views.py | |
# https://github.com/jayhale/vercel-django-example/blob/main/example/views.py#L6 | |
from datetime import datetime | |
from django.http import HttpResponse | |
def index(request): | |
now = datetime.now() | |
html = f''' | |
<html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vercel-django-example/vercel_app/urls.py | |
# https://github.com/jayhale/vercel-django-example/blob/main/vercel_app/urls.py#L21 | |
urlpatterns = [ | |
# ... | |
path('', include('example.urls')), | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vercel-django-example/vercel_app/settings.py | |
# https://github.com/jayhale/vercel-django-example/blob/main/vercel_app/settings.py#L43 | |
INSTALLED_APPS = [ | |
# ... | |
'example', | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 2, | |
"name": "now-django-staticfiles", | |
"builds": [ | |
{ | |
"src": "now_build_staticfiles.sh", | |
"use": "@now/static-build", | |
"config": { | |
"distDir": "staticfiles_build" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# now_build_staticfiles.sh | |
# Install Python 3.6 since it is missing in the Now build environment | |
yum install -y https://centos6.iuscommunity.org/ius-release.rpm | |
yum install -y python36u | |
# Install pip | |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
python3.6 get-pip.py |
NewerOlder