Skip to content

Commit

Permalink
feat: add vercel json
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew4Coding committed Oct 10, 2024
1 parent 13c6b66 commit 0d38bf6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 26 deletions.
46 changes: 25 additions & 21 deletions eventyog/settings.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
"""
Django settings for eventyog project.
Generated by 'django-admin startproject' using Django 4.2.16.
Generated by 'django-admin startproject' using Django 5.1.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
https://docs.djangoproject.com/en/5.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-@&$oww)3kym4#4ex8tz^+ky$h%gi$ev5if&=d+zkt=%(*-7!8r'
SECRET_KEY = 'django-insecure-zob1=r7z=fjniwac*ljo#^o*uiv201#xke*1#4+=m7xxdjx$pv'

PRODUCTION = os.getenv('PRODUCTION', False)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = not PRODUCTION

ALLOWED_HOSTS = ['*']

ALLOWED_HOSTS = ["*"]

# Application definition

Expand All @@ -41,8 +45,8 @@

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down Expand Up @@ -72,7 +76,7 @@


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

DATABASES = {
'default': {
Expand All @@ -83,7 +87,7 @@


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -102,7 +106,7 @@


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
# https://docs.djangoproject.com/en/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

Expand All @@ -113,17 +117,17 @@
USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / 'static']

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

STATIC_ROOT = BASE_DIR / 'staticfiles'

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
# Static files (CSS, JavaScript, Images)
# Dokumentasi: https://docs.djangoproject .com/en/5.1/howto/static-files/
STATIC_URL = '/static/'
if DEBUG:
STATICFILES_DIRS = [
BASE_DIR / 'static' # merujuk ke /static root project pada mode development
]
else:
STATIC_ROOT = BASE_DIR / 'static'
2 changes: 1 addition & 1 deletion main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# Create your views here.
def main(request):
return HttpResponse("Hello, World!")
return render(request, 'base.html')
File renamed without changes.
8 changes: 4 additions & 4 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Manrope:[email protected]&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
{% comment %} <link rel="shortcut icon" type="image/png" href="{% static 'images/icon.png' %}" > {% endcomment %}
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="{% static "styles/main.css" %}">
<script>
tailwind.config = {
theme: {
Expand All @@ -24,10 +23,11 @@
}
}
</script>
<link rel="stylesheet" href="{% static "css/global.css" %}">
<script src="{% static "js/index.js" %}"></script>
<script src="https://cdn.tailwindcss.com"></script>
{% block meta %}{% endblock meta %}
</head>
<body>
<body class="font-Inter">
<main>
{% block content %}{% endblock content%}
</main>
Expand Down
15 changes: 15 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"builds": [
{
"src": "eventyog/wsgi.py",
"use": "@vercel/python",
"config": { "maxLambdaSize": "15mb", "runtime": "python3.11.3" }
}
],
"routes": [
{
"src": "/(.*)",
"dest": "eventyog/wsgi.py"
}
]
}

0 comments on commit 0d38bf6

Please sign in to comment.