Base of template and statics

This commit is contained in:
Ethanell 2021-12-02 19:30:42 +01:00
parent 8a92ec0451
commit e3d1a776be
9 changed files with 31 additions and 2 deletions

View file

@ -0,0 +1,6 @@
from django.db.models import Model, CharField, TextField
class Rescue(Model):
name = CharField(max_length="256")
text = TextField()

View file

View file

@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from os import path
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-85h5=0vw&7e)%9+^n69y!b1ti@7gij_ic3u+66eln838s=!n+l
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["3cab-134-214-214-199.ngrok.io", "localhost"]
# Application definition
@ -120,6 +120,10 @@ USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = ''
STATICFILES_DIRS = (path.join('static'),)
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

View file

@ -16,6 +16,9 @@ Including another URLconf
from django.contrib import admin
from django.urls import path
from nuitdelinfo_2021 import views
urlpatterns = [
path('', views.index, name="index"),
path('admin/', admin.site.urls),
]

View file

@ -0,0 +1 @@
from .index import index

View file

@ -0,0 +1,6 @@
from django.shortcuts import render
def index(request):
context = {}
return render(request, "index.html", context)

3
static/css/style.css Normal file
View file

@ -0,0 +1,3 @@
h1 {
color: red;
}

1
static/js/script.js Normal file
View file

@ -0,0 +1 @@
console.log("Hewo :3");

5
templates/index.html Normal file
View file

@ -0,0 +1,5 @@
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
<script src="{% static 'js/script.js' %}"></script>
<h1>Hewo World :3</h1>