mirror of
https://github.com/kristoferssolo/kristofersxyz.git
synced 2025-10-21 18:30:34 +00:00
Prepearing for production
This commit is contained in:
parent
a6dc255279
commit
2a3b5bccbf
4
.gitignore
vendored
4
.gitignore
vendored
@ -127,3 +127,7 @@ dmypy.json
|
|||||||
|
|
||||||
# Pyre type checker
|
# Pyre type checker
|
||||||
.pyre/
|
.pyre/
|
||||||
|
|
||||||
|
|
||||||
|
config.json
|
||||||
|
debug
|
||||||
|
|||||||
@ -10,26 +10,32 @@ For the full list of settings and their values, see
|
|||||||
https://docs.djangoproject.com/en/4.0/ref/settings/
|
https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
if Path(BASE_DIR, 'debug').is_file(): # if `debug` files exists
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
with open(Path(BASE_DIR, 'config.json'), 'r', encoding='UTF-8') as config_file:
|
||||||
|
config = json.load(config_file)
|
||||||
|
else:
|
||||||
|
DEBUG = False
|
||||||
|
with open('/etc/config.json', 'r', encoding='UTF-8') as config_file:
|
||||||
|
config = json.load(config_file)
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = str(os.getenv('SECURITY_KEY'))
|
SECRET_KEY = config['SECRET_KEY']
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = config['ALLOWED_HOSTS']
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
@ -42,6 +48,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'main',
|
'main',
|
||||||
|
'karbs',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
@ -59,7 +66,7 @@ ROOT_URLCONF = 'kristofersxyz.urls'
|
|||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': ['templates'],
|
'DIRS': [Path.joinpath(BASE_DIR, 'templates')],
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
@ -121,11 +128,9 @@ USE_TZ = True
|
|||||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
STATIC_ROOT = Path.joinpath(BASE_DIR, 'static')
|
||||||
|
|
||||||
|
|
||||||
STATICFILES_DIRS = (
|
|
||||||
Path.joinpath(BASE_DIR, 'static'),
|
|
||||||
)
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
|||||||
@ -22,4 +22,6 @@ urlpatterns = [
|
|||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('', include('main.urls')),
|
path('', include('main.urls')),
|
||||||
path('karbs.sh/', include('karbs.urls')),
|
path('karbs.sh/', include('karbs.urls')),
|
||||||
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
]
|
||||||
|
|
||||||
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
asgiref==3.5.2
|
asgiref==3.5.2
|
||||||
Django==4.1
|
Django==4.1
|
||||||
python-dotenv==0.20.0
|
pycodestyle==2.9.1
|
||||||
sqlparse==0.4.2
|
sqlparse==0.4.2
|
||||||
|
toml==0.10.2
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% block title %} {{ title }} {% endblock %}
|
{% block title %} {{ title }} {% endblock %}
|
||||||
{% block meta %}
|
{% block meta %}
|
||||||
<link rel="stylesheet" href="{% static 'css/karbs.css' %}" />
|
<link rel="stylesheet" type="text/css" href="{% static 'karbs/css/karbs.css' %}" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Kristofers Auto-Rice Bootsrapping Script (KARBS)</h1><hr>
|
<h1>Kristofers Auto-Rice Bootsrapping Script (KARBS)</h1><hr>
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
<link rel="stylesheet" href="{% static 'css/layout.css' %}" />
|
<link rel="stylesheet" type="text/css" href="{% static 'main/css/layout.css' %}" />
|
||||||
{% block meta %}{% endblock %}
|
{% block meta %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -26,16 +26,6 @@
|
|||||||
|
|
||||||
<main>{% block content %}{% endblock %}</main>
|
<main>{% block content %}{% endblock %}</main>
|
||||||
|
|
||||||
<!-- <footer> -->
|
|
||||||
<!-- <p class="footer"> -->
|
|
||||||
<!-- Copyright © -->
|
|
||||||
<!-- <script> -->
|
|
||||||
<!-- document.write(new Date().getFullYear()); -->
|
|
||||||
<!-- </script> -->
|
|
||||||
<!-- Kristofers Solo -->
|
|
||||||
<!-- </p> -->
|
|
||||||
<!-- </footer> -->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% block title %} {{ title }} {% endblock %}
|
{% block title %} {{ title }} {% endblock %}
|
||||||
{% block meta %}
|
{% block meta %}
|
||||||
<link rel="stylesheet" href="{% static 'css/index.css' %}" />
|
<link rel="stylesheet" type="text/css" href="{% static 'main/css/index.css' %}" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="center">
|
<div class="center">
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@900&display=swap" rel="stylesheet" />
|
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@900&display=swap" rel="stylesheet" />
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" />
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" />
|
||||||
<link rel="stylesheet" href="{% static 'css/lightsaber.css' %}" />
|
<link rel="stylesheet" type="text/css" href="{% static 'main/css/lightsaber.css' %}" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<label for="green">Green</label>
|
<label for="green">Green</label>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user